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 fs = require("fs");
|
||||||
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
||||||
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
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) {
|
module.exports = function(eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(pluginRss);
|
eleventyConfig.addPlugin(pluginRss);
|
||||||
eleventyConfig.addPlugin(pluginSyntaxHighlight);
|
eleventyConfig.addPlugin(pluginSyntaxHighlight);
|
||||||
|
eleventyConfig.addPlugin(pluginNavigation);
|
||||||
|
|
||||||
eleventyConfig.setDataDeepMerge(true);
|
eleventyConfig.setDataDeepMerge(true);
|
||||||
|
|
||||||
eleventyConfig.addLayoutAlias("post", "layouts/post.njk");
|
eleventyConfig.addLayoutAlias("post", "layouts/post.njk");
|
||||||
@ -33,24 +38,19 @@ module.exports = function(eleventyConfig) {
|
|||||||
eleventyConfig.addPassthroughCopy("img");
|
eleventyConfig.addPassthroughCopy("img");
|
||||||
eleventyConfig.addPassthroughCopy("css");
|
eleventyConfig.addPassthroughCopy("css");
|
||||||
|
|
||||||
/* Markdown Plugins */
|
/* Markdown Overrides */
|
||||||
let markdownIt = require("markdown-it");
|
let markdownLibrary = markdownIt({
|
||||||
let markdownItAnchor = require("markdown-it-anchor");
|
|
||||||
let options = {
|
|
||||||
html: true,
|
html: true,
|
||||||
breaks: true,
|
breaks: true,
|
||||||
linkify: true
|
linkify: true
|
||||||
};
|
}).use(markdownItAnchor, {
|
||||||
let opts = {
|
|
||||||
permalink: true,
|
permalink: true,
|
||||||
permalinkClass: "direct-link",
|
permalinkClass: "direct-link",
|
||||||
permalinkSymbol: "#"
|
permalinkSymbol: "#"
|
||||||
};
|
});
|
||||||
|
eleventyConfig.setLibrary("md", markdownLibrary);
|
||||||
eleventyConfig.setLibrary("md", markdownIt(options)
|
|
||||||
.use(markdownItAnchor, opts)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
// Browsersync Overrides
|
||||||
eleventyConfig.setBrowserSyncConfig({
|
eleventyConfig.setBrowserSyncConfig({
|
||||||
callbacks: {
|
callbacks: {
|
||||||
ready: function(err, browserSync) {
|
ready: function(err, browserSync) {
|
||||||
@ -61,7 +61,12 @@ module.exports = function(eleventyConfig) {
|
|||||||
res.write(content_404);
|
res.write(content_404);
|
||||||
res.end();
|
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.
|
// 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)
|
// 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)
|
// This is only used for link URLs (it does not affect your file structure)
|
||||||
pathPrefix: "/",
|
// 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",
|
markdownTemplateEngine: "liquid",
|
||||||
htmlTemplateEngine: "njk",
|
htmlTemplateEngine: "njk",
|
||||||
dataTemplateEngine: "njk",
|
dataTemplateEngine: "njk",
|
||||||
passthroughFileCopy: true,
|
|
||||||
|
// These are all optional, defaults are shown:
|
||||||
dir: {
|
dir: {
|
||||||
input: ".",
|
input: ".",
|
||||||
includes: "_includes",
|
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.",
|
"subtitle": "I am writing about my experiences as a naval navel-gazer.",
|
||||||
"filename": "feed.xml",
|
"filename": "feed.xml",
|
||||||
"path": "/feed/feed.xml",
|
"path": "/feed/feed.xml",
|
||||||
"url": "https://myurl.com/feed/feed.xml",
|
|
||||||
"id": "https://myurl.com/"
|
"id": "https://myurl.com/"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
|
@ -12,10 +12,12 @@
|
|||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1 class="home"><a href="{{ '/' | url }}">{{ metadata.title }}</a></h1>
|
<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">
|
<ul class="nav">
|
||||||
{%- for nav in collections.nav | reverse -%}
|
{%- for entry in collections.all | eleventyNavigation %}
|
||||||
<li class="nav-item{% if nav.url == page.url %} nav-item-active{% endif %}"><a href="{{ nav.url | url }}">{{ nav.data.navtitle }}</a></li>
|
<li class="nav-item{% if entry.url == page.url %} nav-item-active{% endif %}"><a href="{{ entry.url | url }}">{{ entry.title }}</a></li>
|
||||||
{%- endfor -%}
|
{%- endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@ -23,7 +25,7 @@
|
|||||||
<div class="warning">
|
<div class="warning">
|
||||||
<ol>
|
<ol>
|
||||||
<li>Edit the <code>_data/metadata.json</code> with your blog’s information.</li>
|
<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>
|
<li>Delete this message from <code>_includes/layouts/base.njk</code>.</li>
|
||||||
</ol>
|
</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>
|
<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>
|
<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>
|
<time class="postlist-date" datetime="{{ post.date | htmlDateString }}">{{ post.date | readableDate }}</time>
|
||||||
{% for tag in post.data.tags %}
|
{% for tag in post.data.tags %}
|
||||||
{%- if tag != "posts" -%}
|
{%- if collections.tagList.indexOf(tag) != -1 -%}
|
||||||
{% set tagUrl %}/tags/{{ tag }}/{% endset %}
|
{% set tagUrl %}/tags/{{ tag }}/{% endset %}
|
||||||
<a href="{{ tagUrl | url }}" class="tag">{{ tag }}</a>
|
<a href="{{ tagUrl | url }}" class="tag">{{ tag }}</a>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
layout: layouts/post.njk
|
layout: layouts/post.njk
|
||||||
title: About Me
|
title: About Me
|
||||||
tags:
|
|
||||||
- nav
|
|
||||||
navtitle: About
|
|
||||||
templateClass: tmpl-post
|
templateClass: tmpl-post
|
||||||
|
eleventyNavigation:
|
||||||
|
key: About Me
|
||||||
|
order: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
I am a person that writes stuff.
|
I am a person that writes stuff.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
layout: layouts/home.njk
|
layout: layouts/home.njk
|
||||||
tags:
|
|
||||||
- nav
|
|
||||||
navtitle: Archive
|
|
||||||
permalink: /posts/
|
permalink: /posts/
|
||||||
|
eleventyNavigation:
|
||||||
|
key: Archive
|
||||||
|
order: 2
|
||||||
---
|
---
|
||||||
|
|
||||||
<h1>Archive</h1>
|
<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">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<title>{{ metadata.title }}</title>
|
<title>{{ metadata.title }}</title>
|
||||||
<subtitle>{{ metadata.feed.subtitle }}</subtitle>
|
<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 }}"/>
|
<link href="{{ metadata.url }}"/>
|
||||||
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
|
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
|
||||||
<id>{{ metadata.feed.id }}</id>
|
<id>{{ metadata.feed.id }}</id>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
layout: layouts/home.njk
|
layout: layouts/home.njk
|
||||||
tags:
|
eleventyNavigation:
|
||||||
- nav
|
key: Home
|
||||||
navtitle: Home
|
order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
<h1>Latest 3 Posts</h1>
|
<h1>Latest 3 Posts</h1>
|
||||||
|
10
package.json
10
package.json
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "eleventy-base-blog",
|
"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.",
|
"description": "A starter repository for a blog web site using the Eleventy static site generator.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "eleventy",
|
"build": "eleventy",
|
||||||
"watch": "eleventy --watch",
|
"watch": "eleventy --watch",
|
||||||
|
"serve": "eleventy --serve",
|
||||||
"debug": "DEBUG=* eleventy"
|
"debug": "DEBUG=* eleventy"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -23,10 +24,11 @@
|
|||||||
"homepage": "https://github.com/11ty/eleventy-base-blog#readme",
|
"homepage": "https://github.com/11ty/eleventy-base-blog#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^0.9.0",
|
"@11ty/eleventy": "^0.9.0",
|
||||||
|
"@11ty/eleventy-navigation": "^0.1.3",
|
||||||
"@11ty/eleventy-plugin-rss": "^1.0.7",
|
"@11ty/eleventy-plugin-rss": "^1.0.7",
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^2.0.3",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^3.0.0",
|
||||||
"luxon": "^1.12.0",
|
"luxon": "^1.21.3",
|
||||||
"markdown-it": "^8.4.2",
|
"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