commit 2a93e196d3c293f2d7ec03aeebc3c1066a4d4f44 Author: Crimson Tome <64846840+CrimsonTome@users.noreply.github.com> Date: Fri Oct 15 22:30:12 2021 +0100 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d415404 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 diff --git a/.eleventy.js b/.eleventy.js new file mode 100644 index 0000000..16841f2 --- /dev/null +++ b/.eleventy.js @@ -0,0 +1,142 @@ +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) { + // Add plugins + eleventyConfig.addPlugin(pluginRss); + eleventyConfig.addPlugin(pluginSyntaxHighlight); + eleventyConfig.addPlugin(pluginNavigation); + + // https://www.11ty.dev/docs/data-deep-merge/ + eleventyConfig.setDataDeepMerge(true); + + // Alias `layout: post` to `layout: layouts/post.njk` + eleventyConfig.addLayoutAlias("post", "layouts/post.njk"); + + eleventyConfig.addFilter("readableDate", dateObj => { + return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat("dd LLL yyyy"); + }); + + // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string + eleventyConfig.addFilter('htmlDateString', (dateObj) => { + return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd'); + }); + + // Get the first `n` elements of a collection. + eleventyConfig.addFilter("head", (array, n) => { + if(!Array.isArray(array) || array.length === 0) { + return []; + } + if( n < 0 ) { + return array.slice(n); + } + + return array.slice(0, n); + }); + + // Return the smallest number argument + eleventyConfig.addFilter("min", (...numbers) => { + return Math.min.apply(null, numbers); + }); + + function filterTagList(tags) { + return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1); + } + + eleventyConfig.addFilter("filterTagList", filterTagList) + + // Create an array of all tags + eleventyConfig.addCollection("tagList", function(collection) { + let tagSet = new Set(); + collection.getAll().forEach(item => { + (item.data.tags || []).forEach(tag => tagSet.add(tag)); + }); + + return filterTagList([...tagSet]); + }); + + // Copy the `img` and `css` folders to the output + eleventyConfig.addPassthroughCopy("img"); + eleventyConfig.addPassthroughCopy("css"); + + // Customize Markdown library and settings: + let markdownLibrary = markdownIt({ + html: true, + breaks: true, + linkify: true + }).use(markdownItAnchor, { + permalink: markdownItAnchor.permalink.ariaHidden({ + placement: "after", + class: "direct-link", + symbol: "#", + level: [1,2,3,4], + }), + slugify: eleventyConfig.getFilter("slug") + }); + eleventyConfig.setLibrary("md", markdownLibrary); + + // Override Browsersync defaults (used only with --serve) + eleventyConfig.setBrowserSyncConfig({ + callbacks: { + ready: function(err, browserSync) { + const content_404 = fs.readFileSync('_site/404.html'); + + browserSync.addMiddleware("*", (req, res) => { + // Provides the 404 content without redirect. + res.writeHead(404, {"Content-Type": "text/html; charset=UTF-8"}); + res.write(content_404); + res.end(); + }); + }, + }, + ui: false, + ghostMode: false + }); + + return { + // Control which files Eleventy will process + // e.g.: *.md, *.njk, *.html, *.liquid + templateFormats: [ + "md", + "njk", + "html", + "liquid" + ], + + // ----------------------------------------------------------------- + // If your site deploys to a subdirectory, change `pathPrefix`. + // Don’t worry about leading and trailing slashes, we normalize these. + + // If you don’t have a subdirectory, use "" or "/" (they do the same thing) + // This is only used for link URLs (it does not affect your file structure) + // Best paired with the `url` filter: https://www.11ty.dev/docs/filters/url/ + + // You can also pass this in on the command line using `--pathprefix` + + // Optional (default is shown) + pathPrefix: "/", + // ----------------------------------------------------------------- + + // Pre-process *.md files with: (default: `liquid`) + markdownTemplateEngine: "njk", + + // Pre-process *.html files with: (default: `liquid`) + htmlTemplateEngine: "njk", + + // Opt-out of pre-processing global data JSON files: (default: `liquid`) + dataTemplateEngine: false, + + // These are all optional (defaults are shown): + dir: { + input: ".", + includes: "_includes", + data: "_data", + output: "_site" + } + }; +}; diff --git a/.eleventyignore b/.eleventyignore new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/.eleventyignore @@ -0,0 +1 @@ +README.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..9c56567 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +# These are supported funding model platforms +open_collective: 11ty diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab338d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +_site/ +node_modules/ +package-lock.json diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..48082f7 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +12 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f7c4435 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: node_js +node_js: + - 12 +before_script: + - npm install @11ty/eleventy -g +script: eleventy --pathprefix="/eleventy-base-blog/" +deploy: + local-dir: _site + provider: pages + skip-cleanup: true + github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure + keep-history: true + on: + branch: master diff --git a/404.md b/404.md new file mode 100644 index 0000000..8b9aeea --- /dev/null +++ b/404.md @@ -0,0 +1,17 @@ +--- +layout: layouts/home.njk +permalink: 404.html +eleventyExcludeFromCollections: true +--- +# Content not found. + +Go home. + +{# +Read more: https://www.11ty.dev/docs/quicktips/not-found/ + +This will work for both GitHub pages and Netlify: + +* https://help.github.com/articles/creating-a-custom-404-page-for-your-github-pages-site/ +* https://www.netlify.com/docs/redirects/#custom-404 +#} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..89a4362 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Zach Leatherman @zachleat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..fb7724c --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# eleventy-base-blog + +A starter repository showing how to build a blog with the [Eleventy](https://github.com/11ty/eleventy) static site generator. + +[![Build Status](https://travis-ci.org/11ty/eleventy-base-blog.svg?branch=master)](https://travis-ci.org/11ty/eleventy-base-blog) + +## Demos + +* [Netlify](https://eleventy-base-blog.netlify.com/) +* [GitHub Pages](https://11ty.github.io/eleventy-base-blog/) +* [Remix on Glitch](https://glitch.com/~11ty-eleventy-base-blog) + +## Deploy this to your own site + +These builders are amazing—try them out to get your own Eleventy site in a few clicks! + +* [Get your own Eleventy web site on Netlify](https://app.netlify.com/start/deploy?repository=https://github.com/11ty/eleventy-base-blog) +* [Get your own Eleventy web site on Vercel](https://vercel.com/import/project?template=11ty%2Feleventy-base-blog) + +## Getting Started + +### 1. Clone this Repository + +``` +git clone https://github.com/11ty/eleventy-base-blog.git my-blog-name +``` + + +### 2. Navigate to the directory + +``` +cd my-blog-name +``` + +Specifically have a look at `.eleventy.js` to see if you want to configure any Eleventy options differently. + +### 3. Install dependencies + +``` +npm install +``` + +### 4. Edit _data/metadata.json + +### 5. Run Eleventy + +``` +npx eleventy +``` + +Or build and host locally for local development +``` +npx eleventy --serve +``` + +Or build automatically when a template changes: +``` +npx eleventy --watch +``` + +Or in debug mode: +``` +DEBUG=* npx eleventy +``` + +### Implementation Notes + +* `about/index.md` shows how to add a content page. +* `posts/` has the blog posts but really they can live in any directory. They need only the `post` tag to be added to this collection. +* Add the `nav` tag to add a template to the top level site navigation. For example, this is in use on `index.njk` and `about/index.md`. +* Content can be any template format (blog posts needn’t be markdown, for example). Configure your supported templates in `.eleventy.js` -> `templateFormats`. + * Because `css` and `png` are listed in `templateFormats` but are not supported template types, any files with these extensions will be copied without modification to the output (while keeping the same directory structure). +* The blog post feed template is in `feed/feed.njk`. This is also a good example of using a global data files in that it uses `_data/metadata.json`. +* This example uses three layouts: + * `_includes/layouts/base.njk`: the top level HTML structure + * `_includes/layouts/home.njk`: the home page template (wrapped into `base.njk`) + * `_includes/layouts/post.njk`: the blog post template (wrapped into `base.njk`) +* `_includes/postlist.njk` is a Nunjucks include and is a reusable component used to display a list of all the posts. `index.njk` has an example of how to use it. diff --git a/_data/metadata.json b/_data/metadata.json new file mode 100644 index 0000000..5b9517f --- /dev/null +++ b/_data/metadata.json @@ -0,0 +1,21 @@ +{ + "title": "Your Blog Name", + "url": "https://example.com/", + "language": "en", + "description": "I am writing about my experiences as a naval navel-gazer.", + "feed": { + "subtitle": "I am writing about my experiences as a naval navel-gazer.", + "filename": "feed.xml", + "path": "/feed/feed.xml", + "id": "https://example.com/" + }, + "jsonfeed": { + "path": "/feed/feed.json", + "url": "https://example.com/feed/feed.json" + }, + "author": { + "name": "Your Name Here", + "email": "youremailaddress@example.com", + "url": "https://example.com/about-me/" + } +} diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk new file mode 100644 index 0000000..ad6569e --- /dev/null +++ b/_includes/layouts/base.njk @@ -0,0 +1,45 @@ + + + + + + {{ title or metadata.title }} + + + + + + + +
+

{{ metadata.title }}

+ + {#- Read more about `eleventy-navigation` at https://www.11ty.dev/docs/plugins/navigation/ #} + +
+ + + + +
+
    +
  1. Edit the _data/metadata.json with your blog’s information.
  2. +
  3. (Optional) Edit .eleventy.js with your configuration preferences.
  4. +
  5. Delete this message from _includes/layouts/base.njk.
  6. +
+

This is an Eleventy project created from the eleventy-base-blog repo.

+
+ + + {{ content | safe }} + + + + + + + diff --git a/_includes/layouts/home.njk b/_includes/layouts/home.njk new file mode 100644 index 0000000..ebba6b3 --- /dev/null +++ b/_includes/layouts/home.njk @@ -0,0 +1,5 @@ +--- +layout: layouts/base.njk +templateClass: tmpl-home +--- +{{ content | safe }} diff --git a/_includes/layouts/post.njk b/_includes/layouts/post.njk new file mode 100644 index 0000000..4d7327c --- /dev/null +++ b/_includes/layouts/post.njk @@ -0,0 +1,25 @@ +--- +layout: layouts/base.njk +templateClass: tmpl-post +--- +

{{ title }}

+ + +{%- for tag in tags | filterTagList -%} +{%- set tagUrl %}/tags/{{ tag | slug }}/{% endset -%} +{{ tag }} +{%- endfor %} + +{{ content | safe }} + +{%- if collections.posts %} +{%- set nextPost = collections.posts | getNextCollectionItem(page) %} +{%- set previousPost = collections.posts | getPreviousCollectionItem(page) %} +{%- if nextPost or previousPost %} +
+ +{%- endif %} +{%- endif %} diff --git a/_includes/postslist.njk b/_includes/postslist.njk new file mode 100644 index 0000000..d220513 --- /dev/null +++ b/_includes/postslist.njk @@ -0,0 +1,12 @@ +
    +{% for post in postslist | reverse %} +
  1. + {% if post.data.title %}{{ post.data.title }}{% else %}{{ post.url }}{% endif %} + + {% for tag in post.data.tags | filterTagList %} + {% set tagUrl %}/tags/{{ tag | slug }}/{% endset %} + + {% endfor %} +
  2. +{% endfor %} +
diff --git a/about/index.md b/about/index.md new file mode 100644 index 0000000..c74e8ba --- /dev/null +++ b/about/index.md @@ -0,0 +1,10 @@ +--- +layout: layouts/post.njk +title: About Me +templateClass: tmpl-post +eleventyNavigation: + key: About Me + order: 3 +--- + +I am a person that writes stuff. diff --git a/archive.njk b/archive.njk new file mode 100644 index 0000000..0b277a8 --- /dev/null +++ b/archive.njk @@ -0,0 +1,12 @@ +--- +layout: layouts/home.njk +permalink: /posts/ +eleventyNavigation: + key: Archive + order: 2 +--- + +

Archive

+ +{% set postslist = collections.posts %} +{% include "postslist.njk" %} diff --git a/css/index.css b/css/index.css new file mode 100644 index 0000000..28be668 --- /dev/null +++ b/css/index.css @@ -0,0 +1,249 @@ +/* Colors */ +:root { + --lightgray: #e0e0e0; + --gray: #C0C0C0; + --darkgray: #333; + --navy: #17050F; + --blue: #082840; + --white: #fff; +} + +/* Global stylesheet */ +* { + box-sizing: border-box; +} + +html, +body { + padding: 0; + margin: 0; + font-family: -apple-system, system-ui, sans-serif; + color: var(--darkgray); + background-color: var(--white); +} +p:last-child { + margin-bottom: 0; +} +p, +.tmpl-post li, +img { + max-width: 37.5em; /* 600px /16 */ +} +p, +.tmpl-post li { + line-height: 1.45; +} +a[href] { + color: var(--blue); +} +a[href]:visited { + color: var(--navy); +} +main { + padding: 1rem; +} +main :first-child { + margin-top: 0; +} +header { + border-bottom: 1px dashed var(--lightgray); +} +header:after { + content: ""; + display: table; + clear: both; +} +table { + margin: 1em 0; +} +table td, +table th { + padding-right: 1em; +} + +pre, +code { + font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; + line-height: 1.5; +} +pre { + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + padding: 1em; + margin: .5em 0; + background-color: #f6f6f6; +} +code { + word-break: break-all; +} +.highlight-line { + display: block; + padding: 0.125em 1em; + text-decoration: none; /* override del, ins, mark defaults */ + color: inherit; /* override del, ins, mark defaults */ +} + +/* allow highlighting empty lines */ +.highlight-line:empty:before { + content: " "; +} +/* avoid double line breaks when using display: block; */ +.highlight-line + br { + display: none; +} + +.highlight-line-isdir { + color: #b0b0b0; + background-color: #222; +} +.highlight-line-active { + background-color: #444; + background-color: hsla(0, 0%, 27%, .8); +} +.highlight-line-add { + background-color: #45844b; +} +.highlight-line-remove { + background-color: #902f2f; +} + +/* Header */ +.home { + padding: 0 1rem; + float: left; + margin: 1rem 0; /* 16px /16 */ + font-size: 1em; /* 16px /16 */ +} +.home :link:not(:hover) { + text-decoration: none; +} + +/* Nav */ +.nav { + padding: 0; + list-style: none; + float: left; + margin-left: 1em; +} +.nav-item { + display: inline-block; + margin-right: 1em; +} +.nav-item a[href]:not(:hover) { + text-decoration: none; +} +.nav-item-active { + font-weight: 700; + text-decoration: underline; +} + +/* Posts list */ +.postlist { + list-style: none; + padding: 0; +} +.postlist-item { + display: flex; + flex-wrap: wrap; + align-items: baseline; + counter-increment: start-from -1; + line-height: 1.8; +} +.postlist-item:before { + display: inline-block; + pointer-events: none; + content: "" counter(start-from, decimal-leading-zero) ". "; + line-height: 100%; + text-align: right; +} +.postlist-date, +.postlist-item:before { + font-size: 0.8125em; /* 13px /16 */ + color: var(--darkgray); +} +.postlist-date { + word-spacing: -0.5px; +} +.postlist-link { + padding-left: .25em; + padding-right: .25em; + text-underline-position: from-font; + text-underline-offset: 0; + text-decoration-thickness: 1px; +} +.postlist-item-active .postlist-link { + font-weight: bold; +} +.tmpl-home .postlist-link { + font-size: 1.1875em; /* 19px /16 */ + font-weight: 700; +} + + +/* Tags */ +.post-tag { + display: inline-flex; + align-items: center; + justify-content: center; + text-transform: uppercase; + font-size: 0.75em; /* 12px /16 */ + padding: 0.08333333333333em 0.3333333333333em; /* 1px 4px /12 */ + margin-left: 0.6666666666667em; /* 8px /12 */ + margin-top: 0.5em; /* 6px /12 */ + margin-bottom: 0.5em; /* 6px /12 */ + color: var(--darkgray); + border: 1px solid var(--gray); + border-radius: 0.25em; /* 3px /12 */ + text-decoration: none; + line-height: 1.8; +} +a[href].post-tag, +a[href].post-tag:visited { + color: inherit; +} +a[href].post-tag:hover, +a[href].post-tag:focus { + background-color: var(--lightgray); +} +.postlist-item > .post-tag { + align-self: center; +} + +/* Warning */ +.warning { + background-color: #ffc; + padding: 1em 0.625em; /* 16px 10px /16 */ +} +.warning ol:only-child { + margin: 0; +} + +/* Direct Links / Markdown Headers */ +.direct-link { + font-family: sans-serif; + text-decoration: none; + font-style: normal; + margin-left: .1em; +} +a[href].direct-link, +a[href].direct-link:visited { + color: transparent; +} +a[href].direct-link:focus, +a[href].direct-link:focus:visited, +:hover > a[href].direct-link, +:hover > a[href].direct-link:visited { + color: #aaa; +} diff --git a/css/prism-base16-monokai.dark.css b/css/prism-base16-monokai.dark.css new file mode 100644 index 0000000..dceb2a6 --- /dev/null +++ b/css/prism-base16-monokai.dark.css @@ -0,0 +1,89 @@ +code[class*="language-"], pre[class*="language-"] { + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + background: #272822; + color: #f8f8f2; +} +pre[class*="language-"] { + padding: 1.5em 0; + margin: .5em 0; + overflow: auto; +} +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; +} +.token.comment, .token.prolog, .token.doctype, .token.cdata { + color: #75715e; +} +.token.punctuation { + color: #f8f8f2; +} +.token.namespace { + opacity: .7; +} +.token.operator, .token.boolean, .token.number { + color: #fd971f; +} +.token.property { + color: #f4bf75; +} +.token.tag { + color: #66d9ef; +} +.token.string { + color: #a1efe4; +} +.token.selector { + color: #ae81ff; +} +.token.attr-name { + color: #fd971f; +} +.token.entity, .token.url, .language-css .token.string, .style .token.string { + color: #a1efe4; +} +.token.attr-value, .token.keyword, .token.control, .token.directive, .token.unit { + color: #a6e22e; +} +.token.statement, .token.regex, .token.atrule { + color: #a1efe4; +} +.token.placeholder, .token.variable { + color: #66d9ef; +} +.token.deleted { + text-decoration: line-through; +} +.token.inserted { + border-bottom: 1px dotted #f9f8f5; + text-decoration: none; +} +.token.italic { + font-style: italic; +} +.token.important, .token.bold { + font-weight: bold; +} +.token.important { + color: #f92672; +} +.token.entity { + cursor: help; +} +pre > code.highlight { + outline: 0.4em solid #f92672; + outline-offset: .4em; +} diff --git a/feed/feed.njk b/feed/feed.njk new file mode 100755 index 0000000..161fc93 --- /dev/null +++ b/feed/feed.njk @@ -0,0 +1,29 @@ +--- +# Metadata comes from _data/metadata.json +permalink: "{{ metadata.feed.path }}" +eleventyExcludeFromCollections: true +--- + + + {{ metadata.title }} + {{ metadata.feed.subtitle }} + {% set absoluteUrl %}{{ metadata.feed.path | url | absoluteUrl(metadata.url) }}{% endset %} + + + {{ collections.posts | rssLastUpdatedDate }} + {{ metadata.feed.id }} + + {{ metadata.author.name }} + {{ metadata.author.email }} + + {%- for post in collections.posts | reverse %} + {% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %} + + {{ post.data.title }} + + {{ post.date | rssDate }} + {{ absolutePostUrl }} + {{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }} + + {%- endfor %} + diff --git a/feed/htaccess.njk b/feed/htaccess.njk new file mode 100644 index 0000000..ac4a3c5 --- /dev/null +++ b/feed/htaccess.njk @@ -0,0 +1,6 @@ +--- +permalink: feed/.htaccess +eleventyExcludeFromCollections: true +--- +# For Apache, to show `{{ metadata.feed.filename }}` when browsing to directory /feed/ (hide the file!) +DirectoryIndex {{ metadata.feed.filename }} diff --git a/feed/json.njk b/feed/json.njk new file mode 100644 index 0000000..40bba3c --- /dev/null +++ b/feed/json.njk @@ -0,0 +1,32 @@ +--- +# Metadata comes from _data/metadata.json +permalink: "{{ metadata.jsonfeed.path }}" +eleventyExcludeFromCollections: true +--- +{ + "version": "https://jsonfeed.org/version/1.1", + "title": "{{ metadata.title }}", + "language": "{{ metadata.language }}", + "home_page_url": "{{ metadata.url }}", + "feed_url": "{{ metadata.jsonfeed.url }}", + "description": "{{ metadata.description }}", + "author": { + "name": "{{ metadata.author.name }}", + "url": "{{ metadata.author.url }}" + }, + "items": [ + {%- for post in collections.posts | reverse %} + {%- set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset -%} + { + "id": "{{ absolutePostUrl }}", + "url": "{{ absolutePostUrl }}", + "title": "{{ post.data.title }}", + "content_html": {% if post.templateContent %}{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | dump | safe }}{% else %}""{% endif %}, + "date_published": "{{ post.date | rssDate }}" + } + {%- if not loop.last -%} + , + {%- endif -%} + {%- endfor %} + ] +} diff --git a/img/.gitkeep b/img/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/index.njk b/index.njk new file mode 100644 index 0000000..bf096f7 --- /dev/null +++ b/index.njk @@ -0,0 +1,14 @@ +--- +layout: layouts/home.njk +eleventyNavigation: + key: Home + order: 1 +--- +{% set maxPosts = collections.posts.length | min(3) %} +

Latest {% if maxPosts == 1 %}Post{% else %}{{ maxPosts }} Posts{% endif %}

+ +{% set postslist = collections.posts | head(-3) %} +{% set postslistCounter = collections.posts | length %} +{% include "postslist.njk" %} + +

More posts can be found in the archive.

diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..829d5e5 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,3 @@ +[build] + publish = "_site" + command = "DEBUG=* eleventy" \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..9b1d216 --- /dev/null +++ b/package.json @@ -0,0 +1,35 @@ +{ + "name": "eleventy-base-blog", + "version": "5.0.2", + "description": "A starter repository for a blog web site using the Eleventy static site generator.", + "scripts": { + "build": "eleventy", + "watch": "eleventy --watch", + "serve": "eleventy --serve", + "start": "eleventy --serve", + "debug": "DEBUG=* eleventy" + }, + "repository": { + "type": "git", + "url": "git://github.com/11ty/eleventy-base-blog.git" + }, + "author": { + "name": "Zach Leatherman", + "email": "zachleatherman@gmail.com", + "url": "https://zachleat.com/" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/11ty/eleventy-base-blog/issues" + }, + "homepage": "https://github.com/11ty/eleventy-base-blog#readme", + "devDependencies": { + "@11ty/eleventy": "^0.12.1", + "@11ty/eleventy-navigation": "^0.3.2", + "@11ty/eleventy-plugin-rss": "^1.1.1", + "@11ty/eleventy-plugin-syntaxhighlight": "^3.1.2", + "luxon": "^1.26.0", + "markdown-it": "^12.1.0", + "markdown-it-anchor": "^8.1.2" + } +} diff --git a/page-list.njk b/page-list.njk new file mode 100644 index 0000000..cb53ec6 --- /dev/null +++ b/page-list.njk @@ -0,0 +1,24 @@ +--- +pagination: + data: collections.all + size: 20 + alias: entries +layout: layouts/home.njk +permalink: /page-list/{% if pagination.pageNumber > 0 %}{{ pagination.pageNumber }}/{% endif %} +--- + + + + + + + + +{%- for entry in entries %} + + + + +{%- endfor %} + +
URLPage Title
{{ entry.url }}{{ entry.data.title }}
diff --git a/posts/firstpost.md b/posts/firstpost.md new file mode 100644 index 0000000..21b3d6c --- /dev/null +++ b/posts/firstpost.md @@ -0,0 +1,26 @@ +--- +title: This is my first post. +description: This is a post on My Blog about agile frameworks. +date: 2018-05-01 +tags: + - another tag +layout: layouts/post.njk +--- +Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. + +Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. + +## Section Header + +Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line. + +``` text/2-3 +// this is a command +function myCommand() { + let counter = 0; + counter++; +} + +// Test with a line break above this line. +console.log('Test'); +``` diff --git a/posts/fourthpost.md b/posts/fourthpost.md new file mode 100644 index 0000000..c928a9f --- /dev/null +++ b/posts/fourthpost.md @@ -0,0 +1,15 @@ +--- +title: This is my fourth post. +description: This is a post on My Blog about touchpoints and circling wagons. +date: 2018-09-30 +tags: second tag +layout: layouts/post.njk +--- +Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. + +Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. + +## Section Header + +Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line. + diff --git a/posts/posts.json b/posts/posts.json new file mode 100644 index 0000000..17f25d5 --- /dev/null +++ b/posts/posts.json @@ -0,0 +1,5 @@ +{ + "tags": [ + "posts" + ] +} diff --git a/posts/secondpost.md b/posts/secondpost.md new file mode 100644 index 0000000..e2e4ca4 --- /dev/null +++ b/posts/secondpost.md @@ -0,0 +1,18 @@ +--- +title: This is my second post. +description: This is a post on My Blog about leveraging agile frameworks. +date: 2018-07-04 +tags: + - number 2 +layout: layouts/post.njk +--- +Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. + +## Section Header + +First post +Third post + +Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. + +Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line. diff --git a/posts/thirdpost.md b/posts/thirdpost.md new file mode 100644 index 0000000..7740e12 --- /dev/null +++ b/posts/thirdpost.md @@ -0,0 +1,29 @@ +--- +title: This is my third post. +description: This is a post on My Blog about win-win survival strategies. +date: 2018-08-24 +tags: + - second tag + - posts with two tags +layout: layouts/post.njk +--- +Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. + +``` js/2/4 +// this is a command +function myCommand() { + let counter = 0; + + counter++; + +} + +// Test with a line break above this line. +console.log('Test'); +``` + +Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring. + +## Section Header + +Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line. diff --git a/sitemap.xml.njk b/sitemap.xml.njk new file mode 100644 index 0000000..0a74480 --- /dev/null +++ b/sitemap.xml.njk @@ -0,0 +1,14 @@ +--- +permalink: /sitemap.xml +eleventyExcludeFromCollections: true +--- + + +{%- for page in collections.all %} + {% set absoluteUrl %}{{ page.url | url | absoluteUrl(metadata.url) }}{% endset %} + + {{ absoluteUrl }} + {{ page.date | htmlDateString }} + +{%- endfor %} + diff --git a/tags-list.njk b/tags-list.njk new file mode 100644 index 0000000..2553860 --- /dev/null +++ b/tags-list.njk @@ -0,0 +1,10 @@ +--- +permalink: /tags/ +layout: layouts/home.njk +--- +

Tags

+ +{% for tag in collections.tagList %} + {% set tagUrl %}/tags/{{ tag | slug }}/{% endset %} + {{ tag }} +{% endfor %} diff --git a/tags.njk b/tags.njk new file mode 100644 index 0000000..0fbd53b --- /dev/null +++ b/tags.njk @@ -0,0 +1,23 @@ +--- +pagination: + data: collections + size: 1 + alias: tag + filter: + - all + - nav + - post + - posts + - tagList + addAllPagesToCollections: true +layout: layouts/home.njk +eleventyComputed: + title: Tagged “{{ tag }}” +permalink: /tags/{{ tag | slug }}/ +--- +

Tagged “{{ tag }}”

+ +{% set postslist = collections[ tag ] %} +{% include "postslist.njk" %} + +

See all tags.