Skip to content

Commit

Permalink
feat: 11yt settings (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcelestino authored Oct 30, 2024
1 parent d1f09a1 commit 9666435
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
10 changes: 9 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');

module.exports = (eleventyConfig) => {
eleventyConfig.addPassthroughCopy('assets');

eleventyConfig.addCollection('post', (collection) => {
// reversed all collections posts
return collection.getFilteredByGlob('posts/**/*.md').reverse();
});

eleventyConfig.addFilter('readableDate', (dateObj) => {
const date = new Date(dateObj);
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
Expand All @@ -11,13 +17,15 @@ module.exports = (eleventyConfig) => {
year: 'numeric',
});
});

eleventyConfig.addPlugin(syntaxHighlight);

return {
dir: {
input: './',
output: './_site',
layouts: './_layouts',
},
templateFormats: ['html', 'liquid', 'md', 'njk'],
templateFormats: ['html', 'md'],
};
};
1 change: 1 addition & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
eleventyExcludeFromCollections: true
title: Not Found
permalink: 404.html
layout: default
Expand Down
6 changes: 3 additions & 3 deletions index.njk → index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
layout: default
---

<div>
<div class="top__descr">Anotações para mim mesmo, mas se tiver interesse em ler, fique a vontade.</div>
<ol reversed class="post-list">
{%- for post in collections.post | reverse -%}
{%- for post in collections.post -%}
<li>
<span class="post-meta">{{ post.date | readableDate }}</span>
<h2>
<a class="post-link" href="{{ post.url | url }}">{{ post.data.title | safe }}</a>
<a class="post-link" href="{{ post.url | url }}">{{ post.data.title | raw }}</a>
</h2>
</li>
{%- endfor -%}
</ol>
</div>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"clean": "rm -rf ./_site",
"build": "npm run clean && eleventy --pathprefix=bloco-de-notas",
"dev": "DEBUG=Eleventy* eleventy --serve --watch",
"dev": "yarn clean && DEBUG=Eleventy* eleventy --serve --watch",
"start": "eleventy --serve --watch"
},
"repository": {
Expand Down

0 comments on commit 9666435

Please sign in to comment.