Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
x87 committed Feb 6, 2024
1 parent c025276 commit c11cd25
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 1,464 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- name: Build gh-pages
run: |
npm install
npm run prod:css
npm run build
- name: Deploy gh-pages
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_site/
node_modules/
package-lock.json
public/css/styles.css
2 changes: 1 addition & 1 deletion _data/toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"pages": [
{
"name": "Welcome",
"slug": "/welcome/"
"slug": "/"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion _includes/layouts/post.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout: layouts/base.njk
{# Only include the syntax highlighter CSS on blog posts #}
{%- css %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %}
{%- css %}{% include "public/css/prism-diff.css" %}{%- endcss %}
<h1>{{ title }}</h1>
<h1>{{ page.url | pageTitle }}</h1>
{{ content | safe }}
{%- set previousPost = page.url | prevPage %}
{%- set nextPost = page.url | nextPage %}
Expand Down
26 changes: 17 additions & 9 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(pluginBundle);

// Filters
eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => {
// Formatting tokens for Luxon: https://moment.github.io/luxon/#/formatting?id=table-of-tokens
return DateTime.fromJSDate(dateObj, { zone: zone || "utc" }).toFormat(
format || "dd LLLL yyyy"
);
});

eleventyConfig.addFilter("htmlDateString", (dateObj) => {
// dateObj input: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
return DateTime.fromJSDate(dateObj, { zone: "utc" }).toFormat("yyyy-LL-dd");
Expand Down Expand Up @@ -77,6 +69,22 @@ module.exports = function (eleventyConfig) {
return null;
});

eleventyConfig.addFilter("pageTitle", function (slug) {
const sections = toc.sections;
for (let j = 0; j < sections.length; j++) {
for (let i = 0; i < sections[j].pages.length; i++) {
if (slug === sections[j].pages[i].slug) {
return (
sections[j].pages[i].name || null
);
}
}
}

return null;
});


// Customize Markdown library settings:
eleventyConfig.amendLibrary("md", (mdLib) => {
mdLib.use(markdownItAnchor, {
Expand All @@ -86,7 +94,7 @@ module.exports = function (eleventyConfig) {
symbol: "#",
ariaHidden: false,
}),
level: [1, 2, 3, 4],
level: [2, 3, 4],
slugify: eleventyConfig.getFilter("slugify"),
});
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"debug": "DEBUG=Eleventy* npx @11ty/eleventy",
"debugstart": "DEBUG=Eleventy* npx @11ty/eleventy --serve --quiet",
"benchmark": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy",
"dev:css": "tailwindcss -i public/css/styles.pcss -o public/css/styles.css --watch --postcss"
"dev:css": "tailwindcss -i public/css/styles.pcss -o public/css/styles.css --watch --postcss",
"prod:css": "tailwindcss -i public/css/styles.pcss -o public/css/styles.css --minify --postcss"
},
"repository": {
"type": "git",
Expand All @@ -30,7 +31,6 @@
"@11ty/eleventy-img": "^3.1.1",
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-bundle": "^1.0.4",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"autoprefixer": "^10.4.0",
"luxon": "^3.3.0",
Expand Down
Loading

0 comments on commit c11cd25

Please sign in to comment.