add blog
This commit is contained in:
parent
f33312d40c
commit
5dfef6e0d4
11 changed files with 116 additions and 11 deletions
22
.eleventy.js
22
.eleventy.js
|
@ -3,17 +3,33 @@ module.exports = function (eleventyConfig) {
|
|||
if (str instanceof Date) {
|
||||
return str;
|
||||
}
|
||||
const date = DateTime.fromISO(str, { zone: "utc" });
|
||||
return date.toJSDate();
|
||||
return Date.parse(str);
|
||||
};
|
||||
|
||||
const formatPart = (part, date) =>
|
||||
new Intl.DateTimeFormat("en", part).format(date);
|
||||
|
||||
eleventyConfig.addPassthroughCopy({ "src/static": "/" });
|
||||
|
||||
eleventyConfig.addFilter("date_to_datetime", (obj) => {
|
||||
const date = parseDate(obj);
|
||||
return DateTime.fromJSDate(date).toUTC().toISO();
|
||||
return date.toISOString();
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("date_formatted", (obj) => {
|
||||
const date = parseDate(obj);
|
||||
|
||||
const month = formatPart({ month: "short" }, date);
|
||||
const day = formatPart({ day: "numeric" }, date);
|
||||
const year = formatPart({ year: "numeric" }, date);
|
||||
|
||||
return `${month} ${day}, ${year}`;
|
||||
});
|
||||
|
||||
eleventyConfig.addCollection('posts', collection => {
|
||||
return collection.getFilteredByGlob('src/posts/*.md').reverse()
|
||||
})
|
||||
|
||||
return {
|
||||
templateFormats: ["njk", "md", "html"],
|
||||
dir: {
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
"name": "home",
|
||||
"link": "/"
|
||||
},
|
||||
{
|
||||
"name": "blog",
|
||||
"link": "/posts/"
|
||||
},
|
||||
{
|
||||
"name": "sample packs",
|
||||
"link": "/samples/"
|
||||
|
|
17
src/_includes/components/pagination.njk
Normal file
17
src/_includes/components/pagination.njk
Normal file
|
@ -0,0 +1,17 @@
|
|||
<nav>
|
||||
{% if pagination.nextPageLink -%}
|
||||
{% set nextPageNumber = pagination.pageNumber + 1 %}
|
||||
{% set nextPageLink = 'page/' ~ nextPageNumber %}
|
||||
<a href="/{{ page.fileSlug }}/{{ nextPageLink }}" rel="prev">Older</a>
|
||||
{%- endif %}
|
||||
|
||||
{% if pagination.previousPageLink -%}
|
||||
{% set previousPageNumber = pagination.pageNumber - 1 %}
|
||||
{%- if pagination.pageNumber == 1 -%}
|
||||
{% set previousPageLink = '' %}
|
||||
{%- else -%}
|
||||
{% set previousPageLink = 'page/' ~ previousPageNumber %}
|
||||
{%- endif -%}
|
||||
<a href="/{{ page.fileSlug }}/{{ previousPageLink }}" rel="next">Newer</a>
|
||||
{%- endif %}
|
||||
</nav>
|
|
@ -21,12 +21,12 @@
|
|||
<meta name="theme-color" content="#eca9cb">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<header id="site_header">
|
||||
<h1>maia <sub>{{ subhead if subhead else "arson crimew" }}</sub></h1>
|
||||
{% include "components/navigation.njk" %}
|
||||
</header>
|
||||
<div id="content">
|
||||
{% block content %}{% endblock %}
|
||||
{% block main %}{% endblock %}
|
||||
</div>
|
||||
{% include "components/footer.njk" %}
|
||||
</body>
|
||||
|
|
16
src/_includes/layouts/post.njk
Normal file
16
src/_includes/layouts/post.njk
Normal file
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
subhead: blog
|
||||
---
|
||||
{% extends 'layouts/default.njk' %}
|
||||
{% block main %}
|
||||
<article>
|
||||
<header class="article_header">
|
||||
<div class="byline">
|
||||
<time datetime="{{date | date_to_datetime }}">{{ date | date_formatted }}</time>
|
||||
<span>by <span class="author by" id="author">{{ site.name }}</span></span>
|
||||
</div>
|
||||
<h1>{{ title }}</h1>
|
||||
</header>
|
||||
{{ content | safe }}
|
||||
</article>
|
||||
{% endblock %}
|
|
@ -2,7 +2,7 @@
|
|||
permalink: /index.html
|
||||
---
|
||||
{% extends 'layouts/default.njk' %}
|
||||
{% block content %}
|
||||
{% block main %}
|
||||
<p>
|
||||
hello i am {{ site.name }} <sup>({{ site.pronouns }})</sup> and this website is not finished at all as a
|
||||
matter of fact i havent even rly started working on it yet.
|
||||
|
|
21
src/posts.njk
Normal file
21
src/posts.njk
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
title: maia blog :3
|
||||
subhead: blog
|
||||
pagination:
|
||||
data: collections.posts
|
||||
addAllPagesToCollections: true
|
||||
size: 10
|
||||
permalink: /posts/{% if pagination.pageNumber > 0 %}page/{{ pagination.pageNumber }}/{% endif %}index.html
|
||||
---
|
||||
{% extends 'layouts/default.njk' %}
|
||||
{% block main %}
|
||||
<ul>
|
||||
{% for entry in pagination.items %}
|
||||
<li>
|
||||
<span><a href="{{ entry.url }}">{{ entry.data.title }}</a> on <span><time datetime="{{ entry.data.date | date_to_datetime }}">{{ entry.data.date | date_formatted }}</time></span></span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% include "components/pagination.njk" %}
|
||||
{% endblock %}
|
9
src/posts/example.md
Normal file
9
src/posts/example.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
title: "example blog post"
|
||||
date: 2022-05-31
|
||||
description: "owo"
|
||||
---
|
||||
|
||||
test
|
||||
|
||||
## test
|
4
src/posts/posts.json
Normal file
4
src/posts/posts.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"layout": "layouts/post",
|
||||
"permalink": "posts/{{ page.fileSlug }}/index.html"
|
||||
}
|
|
@ -1,15 +1,16 @@
|
|||
---
|
||||
permalink: /samples/index.html
|
||||
title: maia sample packs :3
|
||||
subhead: sample packs
|
||||
permalink: /samples/index.html
|
||||
---
|
||||
{% extends 'layouts/default.njk' %}
|
||||
{% block content %}
|
||||
{% block main %}
|
||||
<p>here are some sample packs i made!</p>
|
||||
<div>
|
||||
<ul>
|
||||
{% for pack in samplepacks %}
|
||||
<li>
|
||||
<a href="/samples/{{ pack.filename }}"><code>{{ pack.filename }}</code></a> <small title="{{ pack.changes }}">({{ pack.version }})</small> - {{ pack.description }}
|
||||
<a href="/samples/{{ pack.filename }}"><code>{{ pack.filename }}</code></a> <sup title="{{ pack.changes }}">({{ pack.version }})</sup> - {{ pack.description }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -12,7 +12,7 @@ li.lavender-webring-curr-site > a {
|
|||
color: rgb(195, 0, 255);
|
||||
}
|
||||
|
||||
header {
|
||||
#site_header {
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid rgb(255, 0, 140);
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ footer {
|
|||
border-top: 1px solid rgb(255, 0, 140);
|
||||
}
|
||||
|
||||
header,
|
||||
footer,
|
||||
#site_header,
|
||||
.lavender-webring-container {
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -36,6 +36,23 @@ footer,
|
|||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
.byline {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
time, .author {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.article_header {
|
||||
padding-bottom: 4px;
|
||||
border-bottom: 1px dotted rgb(219, 103, 167);
|
||||
}
|
||||
|
||||
.article_header > h1 {
|
||||
margin: 0.1rem;
|
||||
}
|
||||
|
||||
.lavender-webring-container {
|
||||
all: unset;
|
||||
display: flex;
|
||||
|
|
Loading…
Reference in a new issue