Initial commit.

This commit is contained in:
Zach Leatherman 2018-01-16 21:08:47 -06:00
commit c86db0c9ce
19 changed files with 268 additions and 0 deletions

44
.eleventy.js Normal file
View File

@ -0,0 +1,44 @@
const { DateTime } = require("luxon");
function dateToISO(str) {
return DateTime.fromJSDate(str).toISO({ includeOffset: true, suppressMilliseconds: true });
}
module.exports = function(config) {
return {
templateFormats: [
"md",
"njk",
"html",
"png",
"css"
],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",
passthroughFileCopy: true,
dir: {
input: ".",
includes: "_includes",
data: "_data",
output: "_site"
},
nunjucksFilters: {
lastUpdatedDate: collection => {
// Newest date in the collection
return dateToISO(collection[ collection.length - 1 ].date);
},
rssDate: dateObj => {
return dateToISO(dateObj);
},
absoluteUrl: url => {
// If your blog lives in a subdirectory, change this:
let rootDir = "/";
if( !url || url === "/" ) {
return rootDir;
}
return rootDir + url;
}
}
};
};

1
.eleventyignore Normal file
View File

@ -0,0 +1 @@
README.md

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
_site/
node_modules/
package-lock.json

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# eleventy-base-blog
A starter repository for eleventy static site generator projects.

11
_data/metadata.json Normal file
View File

@ -0,0 +1,11 @@
{
"title": "Eleventy, the Blog",
"subtitle": "This is a sample project to showcase the Eleventy Static Site Generator.",
"feedurl": "https://11ty.io/feed/",
"url": "https://11ty.io/",
"id": "https://11ty.io/",
"author": {
"name": "Zach Leatherman",
"email": "zachleat@zachleat.com"
}
}

View File

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en"{% if templateClass %} class="{{ templateClass }}"{% endif %}>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link rel="stylesheet" href="/css/index.css">
<link rel="stylesheet" href="/posts/posts.css">
</head>
<body>
<header>
<a href="/""><img src="/img/logo.png" class="logo"></a>
<ul class="nav">
{%- for nav in collections.nav -%}
<li class="nav-item"><a href="{{ nav.url | absoluteUrl }}">{{ nav.data.navtitle }}</a></li>
{%- endfor -%}
</header>
{{ layoutContent | safe }}
<footer>
<p><em><a href="/feed/">Subscribe to my feed</a></em></p>
<p><em>Current page: <code>{{ page.url }}</code></em></p>
</footer>
</body>
</html>

View File

@ -0,0 +1,7 @@
---
layout: layouts/base.njk
templateClass: tmpl-home
---
<h1>My Blog</h1>
{{ layoutContent | safe }}

View File

@ -0,0 +1,12 @@
---
layout: layouts/base.njk
templateClass: tmpl-post
---
<h1>{{ title }}</h1>
{{ layoutContent | safe }}
<h2>Posts: </h2>
{% import "postlist.njk" as postsm %}
{{ postsm.list(collections.post, page.url) }}

13
_includes/postlist.njk Normal file
View File

@ -0,0 +1,13 @@
{% macro list(posts, url) %}
<ul>
{%- for post in posts -%}
<li{% if post.url == url %} class="post-active"{% endif %}>
<a href="{{ post.url | absoluteUrl }}">{{ post.data.title }}</a>
Tags: {{ post.data.tags | join(", ") }}
{%- if post.url == url %}
(You are here)
{% endif -%}
</li>
{%- endfor -%}
</ul>
{% endmacro %}

10
about/index.md Normal file
View File

@ -0,0 +1,10 @@
---
layout: layouts/home.njk
title: About Me
tags: nav
navtitle: About
templateClass: tmpl-page
---
## About Me
I am a person that writes stuff.

37
css/index.css Normal file
View File

@ -0,0 +1,37 @@
p {
max-width: 37.5em; /* 600px /16 */
}
/* Logo */
.logo {
max-width: 12.5em; /* 200px /16 */
}
.tmpl-page .logo,
.tmpl-post .logo {
max-width: 8.75em; /* 140px /16 */
}
@media (min-width: 31.25em) { /* 500px */
.tmpl-page .logo,
.tmpl-post .logo {
position: absolute;
right: 1em;
top: 1em;
}
.tmpl-page body,
.tmpl-post body {
padding-right: 10em; /* 160px /16 */
}
}
/* Nav */
.nav {
padding: 0;
list-style: none;
}
.nav-item {
display: inline-block;
margin-right: 1em;
}
/* Posts list */
.post-active {
font-weight: bold;
}

25
feed/feed.njk Normal file
View File

@ -0,0 +1,25 @@
---
permalink: feed/atom.xml
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ metadata.title }}</title>
<subtitle>{{ metadata.subtitle }}</subtitle>
<link href="{{ metadata.feedurl }}" rel="self"/>
<link href="{{ metadata.url }}"/>
<updated>{{ collections.post | lastUpdatedDate }}</updated>
<id>{{ metadata.id }}</id>
<author>
<name>{{ metadata.author.name }}</name>
<email>{{ metadata.author.email }}</email>
</author>
{% for post in collections.post %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ metadata.url }}{{ post.url }}"/>
<updated>{{ post.date | rssDate }}</updated>
<id>{{ metadata.url }}{{ post.url }}</id>
<content type="html">{{ post.templateContent }}</content>
</entry>
{% endfor %}
</feed>

5
feed/htaccess.njk Normal file
View File

@ -0,0 +1,5 @@
---
permalink: feed/.htaccess
---
# For Apache, to show `atom.xml` when browsing to directory /feed/ (hide the file!)
DirectoryIndex atom.xml

BIN
img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

9
index.njk Normal file
View File

@ -0,0 +1,9 @@
---
layout: layouts/home.njk
title: My Blog
tags: nav
navtitle: Home
---
{% import "postlist.njk" as postsm %}
{{ postsm.list(collections.post, page) }}

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "eleventy-base-blog",
"version": "1.0.0",
"description": "A starter repository for a blog web site using the Eleventy static site generator.",
"scripts": {
"build": "npx eleventy",
"build-debug": "DEBUG=* npx eleventy",
"build-debug-watch": "DEBUG=* npx eleventy --watch"
},
"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.2.7",
"luxon": "^0.3.1"
}
}

12
posts/firstpost.md Normal file
View File

@ -0,0 +1,12 @@
---
title: This is my first post.
tags:
- post
- 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.
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.

11
posts/secondpost.md Normal file
View File

@ -0,0 +1,11 @@
---
title: This is my second post.
tags:
- post
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.
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.

11
posts/thirdpost.md Normal file
View File

@ -0,0 +1,11 @@
---
title: This is my third post.
tags:
- post
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.
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.