Merge branch 'master' into patch-1
This commit is contained in:
commit
b09636c295
42
.eleventy.js
42
.eleventy.js
@ -2,10 +2,15 @@ const { DateTime } = require("luxon");
|
||||
const fs = require("fs");
|
||||
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
||||
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
||||
const pluginNavigation = require("@11ty/eleventy-navigation");
|
||||
const markdownIt = require("markdown-it");
|
||||
const markdownItAnchor = require("markdown-it-anchor");
|
||||
|
||||
module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPlugin(pluginRss);
|
||||
eleventyConfig.addPlugin(pluginSyntaxHighlight);
|
||||
eleventyConfig.addPlugin(pluginNavigation);
|
||||
|
||||
eleventyConfig.setDataDeepMerge(true);
|
||||
|
||||
eleventyConfig.addLayoutAlias("post", "layouts/post.njk");
|
||||
@ -33,24 +38,19 @@ module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPassthroughCopy("img");
|
||||
eleventyConfig.addPassthroughCopy("css");
|
||||
|
||||
/* Markdown Plugins */
|
||||
let markdownIt = require("markdown-it");
|
||||
let markdownItAnchor = require("markdown-it-anchor");
|
||||
let options = {
|
||||
/* Markdown Overrides */
|
||||
let markdownLibrary = markdownIt({
|
||||
html: true,
|
||||
breaks: true,
|
||||
linkify: true
|
||||
};
|
||||
let opts = {
|
||||
}).use(markdownItAnchor, {
|
||||
permalink: true,
|
||||
permalinkClass: "direct-link",
|
||||
permalinkSymbol: "#"
|
||||
};
|
||||
|
||||
eleventyConfig.setLibrary("md", markdownIt(options)
|
||||
.use(markdownItAnchor, opts)
|
||||
);
|
||||
});
|
||||
eleventyConfig.setLibrary("md", markdownLibrary);
|
||||
|
||||
// Browsersync Overrides
|
||||
eleventyConfig.setBrowserSyncConfig({
|
||||
callbacks: {
|
||||
ready: function(err, browserSync) {
|
||||
@ -61,7 +61,12 @@ module.exports = function(eleventyConfig) {
|
||||
res.write(content_404);
|
||||
res.end();
|
||||
});
|
||||
}
|
||||
},
|
||||
ghostMode: {
|
||||
clicks: false,
|
||||
forms: false,
|
||||
scroll: false,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
@ -74,15 +79,20 @@ module.exports = function(eleventyConfig) {
|
||||
],
|
||||
|
||||
// If your site lives in a different subdirectory, change this.
|
||||
// Leading or trailing slashes are all normalized away, so don’t worry about it.
|
||||
// Leading or trailing slashes are all normalized away, so don’t worry about those.
|
||||
|
||||
// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
|
||||
// This is only used for URLs (it does not affect your file structure)
|
||||
pathPrefix: "/",
|
||||
// This is only used for link URLs (it does not affect your file structure)
|
||||
// Best paired with the `url` filter: https://www.11ty.io/docs/filters/url/
|
||||
|
||||
// You can also pass this in on the command line using `--pathprefix`
|
||||
// pathPrefix: "/",
|
||||
|
||||
markdownTemplateEngine: "liquid",
|
||||
htmlTemplateEngine: "njk",
|
||||
dataTemplateEngine: "njk",
|
||||
passthroughFileCopy: true,
|
||||
|
||||
// These are all optional, defaults are shown:
|
||||
dir: {
|
||||
input: ".",
|
||||
includes: "_includes",
|
||||
|
1
_data/metadata.json
Normal file → Executable file
1
_data/metadata.json
Normal file → Executable file
@ -6,7 +6,6 @@
|
||||
"subtitle": "I am writing about my experiences as a naval navel-gazer.",
|
||||
"filename": "feed.xml",
|
||||
"path": "/feed/feed.xml",
|
||||
"url": "https://myurl.com/feed/feed.xml",
|
||||
"id": "https://myurl.com/"
|
||||
},
|
||||
"author": {
|
||||
|
@ -12,10 +12,12 @@
|
||||
<body>
|
||||
<header>
|
||||
<h1 class="home"><a href="{{ '/' | url }}">{{ metadata.title }}</a></h1>
|
||||
|
||||
{#- Read more about `eleventy-navigation` at https://www.11ty.dev/docs/plugins/navigation/ #}
|
||||
<ul class="nav">
|
||||
{%- for nav in collections.nav | reverse -%}
|
||||
<li class="nav-item{% if nav.url == page.url %} nav-item-active{% endif %}"><a href="{{ nav.url | url }}">{{ nav.data.navtitle }}</a></li>
|
||||
{%- endfor -%}
|
||||
{%- for entry in collections.all | eleventyNavigation %}
|
||||
<li class="nav-item{% if entry.url == page.url %} nav-item-active{% endif %}"><a href="{{ entry.url | url }}">{{ entry.title }}</a></li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
@ -23,7 +25,7 @@
|
||||
<div class="warning">
|
||||
<ol>
|
||||
<li>Edit the <code>_data/metadata.json</code> with your blog’s information.</li>
|
||||
<li>(Optional) Edit <code>.eleventy.js</code> with your configuration preferences.</li>
|
||||
<li>(Optional) Edit <code>.eleventy.js</code> with your [configuration preferences](https://www.11ty.dev/docs/config/).</li>
|
||||
<li>Delete this message from <code>_includes/layouts/base.njk</code>.</li>
|
||||
</ol>
|
||||
<p><em>This is an <a href="https://www.11ty.io/">Eleventy project</a> created from the <a href="https://github.com/11ty/eleventy-base-blog"><code>eleventy-base-blog</code> repo</a>.</em></p>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<a href="{{ post.url | url }}" class="postlist-link">{% if post.data.title %}{{ post.data.title }}{% else %}<code>{{ post.url }}</code>{% endif %}</a>
|
||||
<time class="postlist-date" datetime="{{ post.date | htmlDateString }}">{{ post.date | readableDate }}</time>
|
||||
{% for tag in post.data.tags %}
|
||||
{%- if tag != "posts" -%}
|
||||
{%- if collections.tagList.indexOf(tag) != -1 -%}
|
||||
{% set tagUrl %}/tags/{{ tag }}/{% endset %}
|
||||
<a href="{{ tagUrl | url }}" class="tag">{{ tag }}</a>
|
||||
{%- endif -%}
|
||||
|
@ -1,10 +1,10 @@
|
||||
---
|
||||
layout: layouts/post.njk
|
||||
title: About Me
|
||||
tags:
|
||||
- nav
|
||||
navtitle: About
|
||||
templateClass: tmpl-post
|
||||
eleventyNavigation:
|
||||
key: About Me
|
||||
order: 3
|
||||
---
|
||||
|
||||
I am a person that writes stuff.
|
||||
|
@ -1,9 +1,9 @@
|
||||
---
|
||||
layout: layouts/home.njk
|
||||
tags:
|
||||
- nav
|
||||
navtitle: Archive
|
||||
permalink: /posts/
|
||||
eleventyNavigation:
|
||||
key: Archive
|
||||
order: 2
|
||||
---
|
||||
|
||||
<h1>Archive</h1>
|
||||
|
3
feed/feed.njk
Normal file → Executable file
3
feed/feed.njk
Normal file → Executable file
@ -6,7 +6,8 @@ eleventyExcludeFromCollections: true
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title>{{ metadata.title }}</title>
|
||||
<subtitle>{{ metadata.feed.subtitle }}</subtitle>
|
||||
<link href="{{ metadata.feed.url }}" rel="self"/>
|
||||
{% set absoluteUrl %}{{ metadata.feed.path | url | absoluteUrl(metadata.url) }}{% endset %}
|
||||
<link href="{{ absoluteUrl }}" rel="self"/>
|
||||
<link href="{{ metadata.url }}"/>
|
||||
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
|
||||
<id>{{ metadata.feed.id }}</id>
|
||||
|
@ -1,8 +1,8 @@
|
||||
---
|
||||
layout: layouts/home.njk
|
||||
tags:
|
||||
- nav
|
||||
navtitle: Home
|
||||
eleventyNavigation:
|
||||
key: Home
|
||||
order: 1
|
||||
---
|
||||
|
||||
<h1>Latest 3 Posts</h1>
|
||||
|
10
package.json
10
package.json
@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "eleventy-base-blog",
|
||||
"version": "5.0.0",
|
||||
"version": "5.0.1",
|
||||
"description": "A starter repository for a blog web site using the Eleventy static site generator.",
|
||||
"scripts": {
|
||||
"build": "eleventy",
|
||||
"watch": "eleventy --watch",
|
||||
"serve": "eleventy --serve",
|
||||
"debug": "DEBUG=* eleventy"
|
||||
},
|
||||
"repository": {
|
||||
@ -23,10 +24,11 @@
|
||||
"homepage": "https://github.com/11ty/eleventy-base-blog#readme",
|
||||
"devDependencies": {
|
||||
"@11ty/eleventy": "^0.9.0",
|
||||
"@11ty/eleventy-navigation": "^0.1.3",
|
||||
"@11ty/eleventy-plugin-rss": "^1.0.7",
|
||||
"@11ty/eleventy-plugin-syntaxhighlight": "^2.0.3",
|
||||
"luxon": "^1.12.0",
|
||||
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.0",
|
||||
"luxon": "^1.21.3",
|
||||
"markdown-it": "^8.4.2",
|
||||
"markdown-it-anchor": "^5.0.2"
|
||||
"markdown-it-anchor": "^5.2.5"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user