Convert to tabs

This commit is contained in:
Zach Leatherman 2023-01-23 11:37:44 -06:00
parent 1f09716cd8
commit e6dc55c4df
14 changed files with 226 additions and 228 deletions

View File

@ -1,7 +1,7 @@
root = true root = true
[*] [*]
indent_style = space indent_style = tab
indent_size = 2 indent_size = 2
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true

View File

@ -1,11 +1,11 @@
{ {
"title": "Your Blog Name", "title": "Your Blog Name",
"url": "https://example.com/", "url": "https://example.com/",
"language": "en", "language": "en",
"description": "I am writing about my experiences as a naval navel-gazer.", "description": "I am writing about my experiences as a naval navel-gazer.",
"author": { "author": {
"name": "Your Name Here", "name": "Your Name Here",
"email": "youremailaddress@example.com", "email": "youremailaddress@example.com",
"url": "https://example.com/about-me/" "url": "https://example.com/about-me/"
} }
} }

View File

@ -1,44 +1,44 @@
<!doctype html> <!doctype html>
<html lang="{{ metadata.language }}"> <html lang="{{ metadata.language }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title or metadata.title }}</title> <title>{{ title or metadata.title }}</title>
<meta name="description" content="{{ description or metadata.description }}"> <meta name="description" content="{{ description or metadata.description }}">
{#- Uncomment this if youd like folks to know that you used Eleventy to build your site! #} {#- Uncomment this if youd like folks to know that you used Eleventy to build your site! #}
{#- <meta name="generator" content="{{ eleventy.generator }}"> #} {#- <meta name="generator" content="{{ eleventy.generator }}"> #}
<link rel="stylesheet" href="/css/index.css"> <link rel="stylesheet" href="/css/index.css">
<link rel="stylesheet" href="/css/prism-okaidia.css"> <link rel="stylesheet" href="/css/prism-okaidia.css">
<link rel="stylesheet" href="/css/prism-diff.css"> <link rel="stylesheet" href="/css/prism-diff.css">
<link rel="alternate" href="/feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}"> <link rel="alternate" href="/feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}">
<link rel="alternate" href="/feed/feed.json" type="application/json" title="{{ metadata.title }}"> <link rel="alternate" href="/feed/feed.json" type="application/json" title="{{ metadata.title }}">
</head> </head>
<body> <body>
<a href="#skip" class="visually-hidden">Skip to main content</a> <a href="#skip" class="visually-hidden">Skip to main content</a>
<header> <header>
<a href="/" class="home-link">{{ metadata.title }}</a> <a href="/" class="home-link">{{ metadata.title }}</a>
{#- Read more about `eleventy-navigation` at https://www.11ty.dev/docs/plugins/navigation/ #} {#- Read more about `eleventy-navigation` at https://www.11ty.dev/docs/plugins/navigation/ #}
<nav> <nav>
<ul class="nav"> <ul class="nav">
<h2 class="visually-hidden">Top level navigation menu</h2> <h2 class="visually-hidden">Top level navigation menu</h2>
{%- for entry in collections.all | eleventyNavigation %} {%- for entry in collections.all | eleventyNavigation %}
<li class="nav-item"><a href="{{ entry.url }}"{% if entry.url == page.url %} aria-current="page"{% endif %}>{{ entry.title }}</a></li> <li class="nav-item"><a href="{{ entry.url }}"{% if entry.url == page.url %} aria-current="page"{% endif %}>{{ entry.title }}</a></li>
{%- endfor %} {%- endfor %}
</ul> </ul>
</nav> </nav>
</header> </header>
<main id="skip"> <main id="skip">
{{ content | safe }} {{ content | safe }}
</main> </main>
<footer></footer> <footer></footer>
<!-- Current page: {{ page.url | htmlBaseUrl }} --> <!-- Current page: {{ page.url | htmlBaseUrl }} -->
</body> </body>
</html> </html>

View File

@ -3,13 +3,13 @@ layout: layouts/base.njk
--- ---
<!-- Delete this message --> <!-- Delete this message -->
<div class="message-box"> <div class="message-box">
<link rel="stylesheet" href="/css/message-box.css"> <link rel="stylesheet" href="/css/message-box.css">
<ol> <ol>
<li>Edit the <code>_data/metadata.json</code> with your blogs information.</li> <li>Edit the <code>_data/metadata.json</code> with your blogs information.</li>
<li>(Optional) Edit <code>eleventy.config.js</code> with your <a href="https://www.11ty.dev/docs/config/">configuration preferences</a>.</li> <li>(Optional) Edit <code>eleventy.config.js</code> with your <a href="https://www.11ty.dev/docs/config/">configuration preferences</a>.</li>
<li>Delete this message from <code>_includes/layouts/home.njk</code>.</li> <li>Delete this message from <code>_includes/layouts/home.njk</code>.</li>
</ol> </ol>
<p><em>This is an <a href="https://www.11ty.dev/">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.dev/">Eleventy project</a> created from the <a href="https://github.com/11ty/eleventy-base-blog"><code>eleventy-base-blog</code> repo</a>.</em></p>
</div> </div>
<!-- Stop deleting --> <!-- Stop deleting -->

View File

@ -4,24 +4,22 @@ layout: layouts/base.njk
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<ul class="post-metadata"> <ul class="post-metadata">
<li><time datetime="{{ page.date | htmlDateString }}">{{ page.date | readableDate }}</time></li> <li><time datetime="{{ page.date | htmlDateString }}">{{ page.date | readableDate }}</time></li>
{%- for tag in tags | filterTagList %} {%- for tag in tags | filterTagList %}
{%- set tagUrl %}/tags/{{ tag | slugify }}/{% endset %} {%- set tagUrl %}/tags/{{ tag | slugify }}/{% endset %}
<li><a href="{{ tagUrl }}" class="post-tag">{{ tag }}</a>{%- if not loop.last %}, {% endif %}</li> <li><a href="{{ tagUrl }}" class="post-tag">{{ tag }}</a>{%- if not loop.last %}, {% endif %}</li>
{%- endfor %} {%- endfor %}
</ul> </ul>
{{ content | safe }} {{ content | safe }}
<hr>
{%- if collections.posts %} {%- if collections.posts %}
{%- set previousPost = collections.posts | getPreviousCollectionItem %} {%- set previousPost = collections.posts | getPreviousCollectionItem %}
{%- set nextPost = collections.posts | getNextCollectionItem %} {%- set nextPost = collections.posts | getNextCollectionItem %}
{%- if nextPost or previousPost %} {%- if nextPost or previousPost %}
<ul> <ul class="links-nextprev">
{%- if previousPost %}<li>Previous: <a href="{{ previousPost.url }}">{{ previousPost.data.title }}</a></li>{% endif %} {%- if previousPost %}<li>Previous: <a href="{{ previousPost.url }}">{{ previousPost.data.title }}</a></li>{% endif %}
{%- if nextPost %}<li>Next: <a href="{{ nextPost.url }}">{{ nextPost.data.title }}</a></li>{% endif %} {%- if nextPost %}<li>Next: <a href="{{ nextPost.url }}">{{ nextPost.data.title }}</a></li>{% endif %}
</ul> </ul>
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}

View File

@ -1,8 +1,8 @@
<ol reversed class="postlist" style="counter-reset: start-from {{ (postslistCounter or postslist.length) + 1 }}"> <ol reversed class="postlist" style="counter-reset: start-from {{ (postslistCounter or postslist.length) + 1 }}">
{% for post in postslist | reverse %} {% for post in postslist | reverse %}
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}"> <li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}">
<a href="{{ post.url }}" class="postlist-link">{% if post.data.title %}{{ post.data.title }}{% else %}<code>{{ post.url }}</code>{% endif %}</a> <a href="{{ post.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("LLLL yyyy") }}</time> <time class="postlist-date" datetime="{{ post.date | htmlDateString }}">{{ post.date | readableDate("LLLL yyyy") }}</time>
</li> </li>
{% endfor %} {% endfor %}
</ol> </ol>

View File

@ -1,6 +1,6 @@
{ {
"tags": [ "tags": [
"posts" "posts"
], ],
"layout": "layouts/post.njk" "layout": "layouts/post.njk"
} }

View File

@ -7,113 +7,113 @@ const pluginNavigation = require("@11ty/eleventy-navigation");
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy"); const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
module.exports = function(eleventyConfig) { module.exports = function(eleventyConfig) {
eleventyConfig.ignores.add("README.md"); eleventyConfig.ignores.add("README.md");
// Copy the contents of the `public` folder to the output folder // Copy the contents of the `public` folder to the output folder
// For example, `./public/css/` ends up in `_site/css/` // For example, `./public/css/` ends up in `_site/css/`
eleventyConfig.addPassthroughCopy({ eleventyConfig.addPassthroughCopy({
"./public/": "/", "./public/": "/",
"./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css" "./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css"
}); });
// If your passthrough copy gets heavy and cumbersome, add this line // If your passthrough copy gets heavy and cumbersome, add this line
// to emulate the file copy on the dev server. Learn more: https://www.11ty.dev/docs/copy/#emulate-passthrough-copy-during-serve // to emulate the file copy on the dev server. Learn more: https://www.11ty.dev/docs/copy/#emulate-passthrough-copy-during-serve
// eleventyConfig.setServerPassthroughCopyBehavior("passthrough"); // eleventyConfig.setServerPassthroughCopyBehavior("passthrough");
// Add plugins // Add plugins
eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginSyntaxHighlight); eleventyConfig.addPlugin(pluginSyntaxHighlight);
eleventyConfig.addPlugin(pluginNavigation); eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(EleventyHtmlBasePlugin); eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addFilter("readableDate", (dateObj, format = "dd LLLL yyyy") => { eleventyConfig.addFilter("readableDate", (dateObj, format = "dd LLLL yyyy") => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat(format); return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat(format);
}); });
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter('htmlDateString', (dateObj) => { eleventyConfig.addFilter('htmlDateString', (dateObj) => {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd'); return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
}); });
// Get the first `n` elements of a collection. // Get the first `n` elements of a collection.
eleventyConfig.addFilter("head", (array, n) => { eleventyConfig.addFilter("head", (array, n) => {
if(!Array.isArray(array) || array.length === 0) { if(!Array.isArray(array) || array.length === 0) {
return []; return [];
} }
if( n < 0 ) { if( n < 0 ) {
return array.slice(n); return array.slice(n);
} }
return array.slice(0, n); return array.slice(0, n);
}); });
// Return the smallest number argument // Return the smallest number argument
eleventyConfig.addFilter("min", (...numbers) => { eleventyConfig.addFilter("min", (...numbers) => {
return Math.min.apply(null, numbers); return Math.min.apply(null, numbers);
}); });
// Return all the tags used in a collection // Return all the tags used in a collection
eleventyConfig.addFilter("getAllTags", collection => { eleventyConfig.addFilter("getAllTags", collection => {
let tagSet = new Set(); let tagSet = new Set();
for(let item of collection) { for(let item of collection) {
(item.data.tags || []).forEach(tag => tagSet.add(tag)); (item.data.tags || []).forEach(tag => tagSet.add(tag));
} }
return Array.from(tagSet); return Array.from(tagSet);
}); });
eleventyConfig.addFilter("filterTagList", function filterTagList(tags) { eleventyConfig.addFilter("filterTagList", function filterTagList(tags) {
return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1); return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1);
}); });
// Customize Markdown library settings: // Customize Markdown library settings:
eleventyConfig.amendLibrary("md", mdLib => { eleventyConfig.amendLibrary("md", mdLib => {
mdLib.use(markdownItAnchor, { mdLib.use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.ariaHidden({ permalink: markdownItAnchor.permalink.ariaHidden({
placement: "after", placement: "after",
class: "direct-link", class: "direct-link",
symbol: "#", symbol: "#",
}), }),
level: [1,2,3,4], level: [1,2,3,4],
slugify: eleventyConfig.getFilter("slugify") slugify: eleventyConfig.getFilter("slugify")
}); });
}); });
return { return {
// Control which files Eleventy will process // Control which files Eleventy will process
// e.g.: *.md, *.njk, *.html, *.liquid // e.g.: *.md, *.njk, *.html, *.liquid
templateFormats: [ templateFormats: [
"md", "md",
"njk", "njk",
"html", "html",
"liquid" "liquid"
], ],
// Pre-process *.md files with: (default: `liquid`) // Pre-process *.md files with: (default: `liquid`)
markdownTemplateEngine: "njk", markdownTemplateEngine: "njk",
// Pre-process *.html files with: (default: `liquid`) // Pre-process *.html files with: (default: `liquid`)
htmlTemplateEngine: "njk", htmlTemplateEngine: "njk",
// These are all optional (defaults are shown): // These are all optional (defaults are shown):
dir: { dir: {
input: ".", input: ".",
includes: "_includes", includes: "_includes",
data: "_data", data: "_data",
output: "_site" output: "_site"
} }
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// Optional: // Optional:
// If your site deploys to a subdirectory, change `pathPrefix`. // If your site deploys to a subdirectory, change `pathPrefix`.
// Read more: https://www.11ty.dev/docs/config/#deploy-to-a-subdirectory-with-a-path-prefix // Read more: https://www.11ty.dev/docs/config/#deploy-to-a-subdirectory-with-a-path-prefix
// When paired with the HTML <base> plugin https://www.11ty.dev/docs/plugins/html-base/ // When paired with the HTML <base> plugin https://www.11ty.dev/docs/plugins/html-base/
// it will transform any absolute URLs in your HTML to include this // it will transform any absolute URLs in your HTML to include this
// folder name and does **not** affect where things go in the output folder. // folder name and does **not** affect where things go in the output folder.
// Optional (default is shown) // Optional (default is shown)
// pathPrefix: "/", // pathPrefix: "/",
// ----------------------------------------------------------------- // -----------------------------------------------------------------
}; };
}; };

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
eleventyExcludeFromCollections: true eleventyExcludeFromCollections: true
} }

View File

@ -3,27 +3,27 @@
permalink: /feed/feed.json permalink: /feed/feed.json
--- ---
{ {
"version": "https://jsonfeed.org/version/1.1", "version": "https://jsonfeed.org/version/1.1",
"title": "{{ metadata.title }}", "title": "{{ metadata.title }}",
"language": "{{ metadata.language }}", "language": "{{ metadata.language }}",
"home_page_url": "{{ metadata.url | addPathPrefixToFullUrl }}", "home_page_url": "{{ metadata.url | addPathPrefixToFullUrl }}",
"feed_url": "{{ permalink | htmlBaseUrl(metadata.url) }}", "feed_url": "{{ permalink | htmlBaseUrl(metadata.url) }}",
"description": "{{ metadata.description }}", "description": "{{ metadata.description }}",
"author": { "author": {
"name": "{{ metadata.author.name }}", "name": "{{ metadata.author.name }}",
"url": "{{ metadata.author.url }}" "url": "{{ metadata.author.url }}"
}, },
"items": [ "items": [
{%- for post in collections.posts | reverse %} {%- for post in collections.posts | reverse %}
{%- set absolutePostUrl = post.url | htmlBaseUrl(metadata.url) %} {%- set absolutePostUrl = post.url | htmlBaseUrl(metadata.url) %}
{ {
"id": "{{ absolutePostUrl }}", "id": "{{ absolutePostUrl }}",
"url": "{{ absolutePostUrl }}", "url": "{{ absolutePostUrl }}",
"title": "{{ post.data.title }}", "title": "{{ post.data.title }}",
"content_html": {% if post.templateContent %}{{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) | dump | safe }}{% else %}""{% endif %}, "content_html": {% if post.templateContent %}{{ post.templateContent | transformWithHtmlBase(absolutePostUrl, post.url) | dump | safe }}{% else %}""{% endif %},
"date_published": "{{ post.date | dateToRfc3339 }}" "date_published": "{{ post.date | dateToRfc3339 }}"
} }
{% if not loop.last %},{% endif %} {% if not loop.last %},{% endif %}
{%- endfor %} {%- endfor %}
] ]
} }

View File

@ -19,8 +19,8 @@ eleventyNavigation:
{# List every content page in the project #} {# List every content page in the project #}
{# {#
<ul> <ul>
{%- for entry in collections.all %} {%- for entry in collections.all %}
<li><a href="{{ entry.url }}"><code>{{ entry.url }}</code></a></li> <li><a href="{{ entry.url }}"><code>{{ entry.url }}</code></a></li>
{%- endfor %} {%- endfor %}
</ul> </ul>
#} #}

View File

@ -1,38 +1,38 @@
{ {
"name": "eleventy-base-blog", "name": "eleventy-base-blog",
"version": "7.0.0", "version": "7.0.0",
"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": "npx @11ty/eleventy", "build": "npx @11ty/eleventy",
"build-ghpages": "npx @11ty/eleventy --pathprefix=/eleventy-base-blog/", "build-ghpages": "npx @11ty/eleventy --pathprefix=/eleventy-base-blog/",
"bench": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy", "bench": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy",
"watch": "npx @11ty/eleventy --watch", "watch": "npx @11ty/eleventy --watch",
"serve": "npx @11ty/eleventy --serve", "serve": "npx @11ty/eleventy --serve",
"start": "npx @11ty/eleventy --serve --quiet", "start": "npx @11ty/eleventy --serve --quiet",
"start-ghpages": "npx @11ty/eleventy --serve --quiet --pathprefix=/eleventy-base-blog/", "start-ghpages": "npx @11ty/eleventy --serve --quiet --pathprefix=/eleventy-base-blog/",
"debug": "DEBUG=Eleventy* npx @11ty/eleventy" "debug": "DEBUG=Eleventy* npx @11ty/eleventy"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/11ty/eleventy-base-blog.git" "url": "git://github.com/11ty/eleventy-base-blog.git"
}, },
"author": { "author": {
"name": "Zach Leatherman", "name": "Zach Leatherman",
"email": "zachleatherman@gmail.com", "email": "zachleatherman@gmail.com",
"url": "https://zachleat.com/" "url": "https://zachleat.com/"
}, },
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/11ty/eleventy-base-blog/issues" "url": "https://github.com/11ty/eleventy-base-blog/issues"
}, },
"homepage": "https://github.com/11ty/eleventy-base-blog#readme", "homepage": "https://github.com/11ty/eleventy-base-blog#readme",
"dependencies": { "dependencies": {
"@11ty/eleventy": "2.0.0-beta.1", "@11ty/eleventy": "2.0.0-beta.1",
"@11ty/eleventy-navigation": "^0.3.5", "@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0", "@11ty/eleventy-plugin-syntaxhighlight": "^4.2.0",
"@11ty/eleventy-plugin-webc": "^0.8.1", "@11ty/eleventy-plugin-webc": "^0.8.1",
"luxon": "^3.2.1", "luxon": "^3.2.1",
"markdown-it-anchor": "^8.6.6" "markdown-it-anchor": "^8.6.6"
} }
} }

View File

@ -5,10 +5,10 @@ eleventyExcludeFromCollections: true
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{%- for page in collections.all %} {%- for page in collections.all %}
{% set absoluteUrl %}{{ page.url | htmlBaseUrl(metadata.url) }}{% endset %} {% set absoluteUrl %}{{ page.url | htmlBaseUrl(metadata.url) }}{% endset %}
<url> <url>
<loc>{{ absoluteUrl }}</loc> <loc>{{ absoluteUrl }}</loc>
<lastmod>{{ page.date | htmlDateString }}</lastmod> <lastmod>{{ page.date | htmlDateString }}</lastmod>
</url> </url>
{%- endfor %} {%- endfor %}
</urlset> </urlset>

View File

@ -6,7 +6,7 @@ layout: layouts/home.njk
<ul> <ul>
{% for tag in collections.all | getAllTags | filterTagList %} {% for tag in collections.all | getAllTags | filterTagList %}
{% set tagUrl %}/tags/{{ tag | slugify }}/{% endset %} {% set tagUrl %}/tags/{{ tag | slugify }}/{% endset %}
<li><a href="{{ tagUrl }}" class="post-tag">{{ tag }}</a></li> <li><a href="{{ tagUrl }}" class="post-tag">{{ tag }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>