Skip to content

Commit

Permalink
Update and style blog.
Browse files Browse the repository at this point in the history
It's still very rudimentary, but now there's enough there that it's feasible
to post new content.
  • Loading branch information
n-rook committed Mar 26, 2023
1 parent f87b2d3 commit 83ec0fb
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 16 deletions.
17 changes: 17 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const pluginRss = require("@11ty/eleventy-plugin-rss");
const pluginBundle = require("@11ty/eleventy-plugin-bundle");
const pluginNavigation = require("@11ty/eleventy-navigation");
const eleventy = require("@11ty/eleventy");
const sass = require("sass");

// Thanks to https://github.com/11ty/eleventy-base-blog
// for providing a lot of inspiration!
Expand All @@ -26,17 +27,33 @@ module.exports = function(config) {
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
});

config.addExtension("sass", {
outputFileExtension: "css",

compile: async function(inputContent) {
const result = sass.compileString(
inputContent,
{
syntax: 'indented'
});
return async (data) => result.css;
}
});

return {
dir: {
input: "content",
includes: "../_includes",
data: "../_data",
output: "_site",
},

markdownTemplateEngine: "njk",

htmlTemplateEngine: "njk",

templateFormats: ["html", "md", "njk", "sass"],

pathPrefix: "/",
}
}
4 changes: 4 additions & 0 deletions _data/site_info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
title: 'Silent Selene Blog',
description: 'Keep up with Silent Selene news and new features.'
}
15 changes: 6 additions & 9 deletions _includes/layouts/base.njk
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
<!doctype html>
<html lang="{{ metadata.language }}">
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{ title or metadata.title }}</title>
<meta name="description" content="{{ description or metadata.description }}">
<title>{{ title or site_info.title }}</title>
<meta name="description" content="{{ description or site_info.description }}">

<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.xml" type="application/atom+xml" title="{{ site_info.title }}">

<meta name="generator" content="{{ eleventy.generator }}">

<!-- For best performance, fetch CSS inline -->
<style>{% getBundle "css" %}</style>
<link rel="stylesheet" href="/main.css">
</head>
<body>

<header>
<a href="/" class="home-link">{{ metadata.title }}</a>
<a href="/" class="home-link">{{ site_info.title }}</a>

<nav>
<h2 class="visually-hidden">Top level navigation menu</h2>
<ul class="nav">
{%- 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>
Expand Down
6 changes: 1 addition & 5 deletions _includes/layouts/post.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ layout: layouts/base.njk
permalink: "articles/{{ title | slugify }}/index.html"
---
<h1>{{ title }}</h1>

<ul class="post-metadata">
<li><time datetime="{{ page.date | htmlDateString }}">{{ page.date | readableDate }}</time></li>
<li>{{ author }}</li>
</ul>
<h2 class="post-metadata">Posted by {{ author }} on <time datetime="{{ page.date | htmlDateString }}">{{ page.date | readableDate }}</time></h2>

{{ content | safe }}
34 changes: 34 additions & 0 deletions content/feed.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---json
{
"permalink": "feed.xml",
"eleventyExcludeFromCollections": true,
"metadata": {
"subtitle": "I am writing about my experiences as a naval navel-gazer.",
"language": "en",
"url": "https://news.silentselene.net/",
"author": {
"name": "Boaty McBoatFace",
"email": "[email protected]"
}
}
}
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ metadata.url }}">
<title>{{ site_info.title }}</title>
<subtitle>News and new features at Silent Selene.</subtitle>
<link href="{{ permalink | absoluteUrl(metadata.url) }}" rel="self"/>
<link href="{{ metadata.url }}"/>
<updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ metadata.url }}</id>
{%- for post in collections.posts | reverse %}
{%- set absolutePostUrl = post.url | absoluteUrl(metadata.url) %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
<content xml:lang="{{ metadata.language }}" type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
</entry>
{%- endfor %}
</feed>
4 changes: 4 additions & 0 deletions content/index.md → content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
order: 1
---

<p>Welcome to the Silent Selene blog. We'll post updates about new features and development here.</p>

<p>If you're looking for the main site, <a href="https://www.silentselene.net">go here instead</a>.</p>

<h1>Posts</h1>

<ol reversed class="postlist">
Expand Down
24 changes: 24 additions & 0 deletions content/main.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

// TODO: Import fonts from main site
header
background-color: #420080
min-height: 50px
display: flex
align-items: center
margin: 0 0 5px

.home-link
display: block
color: white
// TODO: Import EB Garamond from main site
font: 600 27px "EB Garamond", "Times New Roman", serif
margin: auto 10px
margin-block: 5px 5px
text-decoration: none

main
max-width: 800px

.post-metadata
font: 200 14px "Lato", "Arial", sans-serif
58 changes: 57 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-bundle": "^1.0.4",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"luxon": "^3.3.0"
"luxon": "^3.3.0",
"sass": "^1.60.0"
}
}

0 comments on commit 83ec0fb

Please sign in to comment.