Browse Source

Initial commit.

upstream
Zach Leatherman 5 years ago
commit
c86db0c9ce
19 changed files with 268 additions and 0 deletions
  1. +44
    -0
      .eleventy.js
  2. +1
    -0
      .eleventyignore
  3. +3
    -0
      .gitignore
  4. +3
    -0
      README.md
  5. +11
    -0
      _data/metadata.json
  6. +26
    -0
      _includes/layouts/base.njk
  7. +7
    -0
      _includes/layouts/home.njk
  8. +12
    -0
      _includes/layouts/post.njk
  9. +13
    -0
      _includes/postlist.njk
  10. +10
    -0
      about/index.md
  11. +37
    -0
      css/index.css
  12. +25
    -0
      feed/feed.njk
  13. +5
    -0
      feed/htaccess.njk
  14. BIN
      img/logo.png
  15. +9
    -0
      index.njk
  16. +28
    -0
      package.json
  17. +12
    -0
      posts/firstpost.md
  18. +11
    -0
      posts/secondpost.md
  19. +11
    -0
      posts/thirdpost.md

+ 44
- 0
.eleventy.js 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
- 0
.eleventyignore View File

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

+ 3
- 0
.gitignore View File

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

+ 3
- 0
README.md View File

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

+ 11
- 0
_data/metadata.json 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"
}
}

+ 26
- 0
_includes/layouts/base.njk 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>

+ 7
- 0
_includes/layouts/home.njk View File

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

+ 12
- 0
_includes/layouts/post.njk 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
- 0
_includes/postlist.njk 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
- 0
about/index.md 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
- 0
css/index.css 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
- 0
feed/feed.njk 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
- 0
feed/htaccess.njk 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 View File

Before After
Width: 1568  |  Height: 2186  |  Size: 17 KiB

+ 9
- 0
index.njk 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
- 0
package.json 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
- 0
posts/firstpost.md 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
- 0
posts/secondpost.md 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
- 0
posts/thirdpost.md 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.

Loading…
Cancel
Save