Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jan 17, 2018
0 parents commit c86db0c
Show file tree
Hide file tree
Showing 19 changed files with 268 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_site/
node_modules/
package-lock.json
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# eleventy-base-blog

A starter repository for eleventy static site generator projects.
11 changes: 11 additions & 0 deletions _data/metadata.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
}
}
26 changes: 26 additions & 0 deletions _includes/layouts/base.njk
Original file line number Diff line number Diff line change
@@ -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>
7 changes: 7 additions & 0 deletions _includes/layouts/home.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: layouts/base.njk
templateClass: tmpl-home
---
<h1>My Blog</h1>

{{ layoutContent | safe }}
12 changes: 12 additions & 0 deletions _includes/layouts/post.njk
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions _includes/postlist.njk
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions about/index.md
Original file line number Diff line number Diff line change
@@ -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 changes: 37 additions & 0 deletions css/index.css
Original file line number Diff line number Diff line change
@@ -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 changes: 25 additions & 0 deletions feed/feed.njk
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions feed/htaccess.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
permalink: feed/.htaccess
---
# For Apache, to show `atom.xml` when browsing to directory /feed/ (hide the file!)
DirectoryIndex atom.xml
Binary file added img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions index.njk
Original file line number Diff line number Diff line change
@@ -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 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"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 changes: 12 additions & 0 deletions posts/firstpost.md
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions posts/secondpost.md
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions posts/thirdpost.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit c86db0c

Please sign in to comment.