Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/assets/file");
eleventyConfig.addPassthroughCopy("src/assets/media");
eleventyConfig.addPassthroughCopy("src/static");
eleventyConfig.addPassthroughCopy({ "src/static/robots.txt": "robots.txt" });

// Keep informal notes separate from the regular post collection.
eleventyConfig.addCollection("ramblings", (collectionApi) => {
Expand Down Expand Up @@ -91,6 +92,10 @@ export default function (eleventyConfig) {

eleventyConfig.addFilter("currentYear", () => new Date().getFullYear());

eleventyConfig.addFilter("absoluteUrl", (url, base) => {
return new URL(url, base).href;
});

eleventyConfig.addFilter("newestUpdatedDate", (items = []) => {
if (!items.length) return new Date();

Expand Down
3 changes: 2 additions & 1 deletion src/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta property="og:title" content="{{ title or site.title }}">
<meta property="og:description" content="{{ description or site.description }}">
<meta property="og:type" content="{% if layout == 'layouts/post.njk' or layout == 'layouts/rambling.njk' %}article{% else %}website{% endif %}">
<meta property="og:url" content="{{ site.url }}{{ page.url }}">
<meta property="og:url" content="{{ page.url | absoluteUrl(site.url) | escape }}">
<meta property="og:site_name" content="{{ site.title }}">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@{{ site.twitter }}">
Expand All @@ -18,6 +18,7 @@
<meta name="twitter:image" content="{{ site.url }}{{ site.icon }}">
<link rel="stylesheet" href="/css/main.css">
<link rel="icon" href="/static/favicon.ico">
<link rel="canonical" href="{{ page.url | absoluteUrl(site.url) | escape }}">
<link rel="alternate" type="application/atom+xml" title="{{ feedTitle or site.title }}" href="{{ feedUrl or '/feed.xml' }}">
</head>
<body class="flex flex-col min-h-screen font-sans text-gray-900 bg-white">
Expand Down
5 changes: 3 additions & 2 deletions src/sitemap.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
{% for page in collections.all %}
{% if page.url and not page.data.eleventyExcludeFromCollections %}
<url>
<loc>{{ site.url }}{{ page.url }}</loc>
<lastmod>{{ page.date | isoDate }}</lastmod>
<loc>{{ page.url | absoluteUrl(site.url) | escape }}</loc>
{% set lastmod = page.data.updated or page.data.date %}
{% if lastmod %}<lastmod>{{ lastmod | isoDate }}</lastmod>{% endif %}
</url>
{% endif %}
{% endfor %}
Expand Down
6 changes: 3 additions & 3 deletions src/static/robots.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Sitemap: https://www.h404bi.com/sitemap.xml

User-agent: *
Disallow: /drafts
Allow: /

Sitemap: https://blog.never.pet/sitemap.xml
Loading