Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps
Browse files Browse the repository at this point in the history
Add sitemap
bcomnes committed Nov 24, 2023
1 parent e5e951c commit 681c886
Showing 11 changed files with 74 additions and 14 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -9,8 +9,7 @@
"url": "https://github.com/hifiwi-fi/hifiwi.fi/issues"
},
"devDependencies": {
"top-bun": "^7.0.0",
"@voxpelli/tsconfig": "^9.0.0",
"@voxpelli/tsconfig": "^10.0.0",
"auto-changelog": "^2.0.0",
"classnames": "^2.3.2",
"gh-release": "^7.0.0",
@@ -19,13 +18,15 @@
"p-map": "^6.0.0",
"snazzy": "^9.0.0",
"standard": "^17.0.0",
"typescript": "~5.2.2",
"top-bun": "^7.0.0",
"typescript": "~5.3.2",
"uland-isomorphic": "^2.0.0"
},
"dependencies": {
"fragmentions": "^1.1.3",
"highlight.js": "^11.5.0",
"mine.css": "^9.0.1"
"mine.css": "^9.0.1",
"xmlbuilder": "^15.1.1"
},
"homepage": "https://github.com/hifiwi-fi/hifiwi.fi",
"keywords": [],
4 changes: 0 additions & 4 deletions src/blog/2023/introducing-hifiwifi/README.md
Original file line number Diff line number Diff line change
@@ -14,10 +14,6 @@ HifiWifi was launched March 5th, 2022 with the following two products:
- 📡 [gumcast](https://gumcast.com) — gumroad subscription courier
- 🥖 [breadcrum.net](https://breadcrum.net) — internet newspaper clippings

A directory of HifiWifi's network infrastructure projects can be found in the installations directory:

- 🚧 [Installation Directory](/installations/)

You can follow HifiWifi on the following channels:

- 🌎 WWW: [hifiwi.fi](http://hifiwi.fi)
3 changes: 2 additions & 1 deletion src/blog/2023/page.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@

export const vars = {
title: '2023 Blog Posts',
layout: 'blog-auto-index'
layout: 'blog-auto-index',
noindex: true
}

/**
3 changes: 2 additions & 1 deletion src/blog/page.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ import { dirname, basename } from 'node:path'

export const vars = {
title: 'Recent Blog Posts',
layout: 'blog-index'
layout: 'blog-index',
noindex: true
}

/**
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/layouts/article.layout.js
Original file line number Diff line number Diff line change
@@ -14,15 +14,15 @@ export default function articleLayout (args) {
<header class="article-header">
<h1 class="p-name article-title" itemprop="headline">${vars.title}</h1>
<div class="metadata">
<address class="author-info" itemprop="author" itemscope itemtype="http://schema.org/Person">
<address class="author-info p-author h-card" itemprop="author" itemscope itemtype="http://schema.org/Person">
${vars.authorImgUrl
? html`<img height="40" width="40" src="${vars.authorImgUrl}" alt="${vars.authorImgAlt}" class="u-photo" itemprop="image">`
: null
}
${vars.authorName && vars.authorUrl
? html`
<a href="${vars.authorUrl}" class="p-author h-card" itemprop="url">
<span itemprop="name">${vars.authorName}</span>
<a href="${vars.authorUrl}" class="u-url" itemprop="url">
<span itemprop="p-name name">${vars.authorName}</span>
</a>`
: null
}
2 changes: 1 addition & 1 deletion src/layouts/root.layout.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import { html, render } from 'uland-isomorphic'

/**
* @template T
* @typedef {import('@siteup/cli').LayoutFunction<T>} LayoutFunction
* @typedef {import('top-bun').LayoutFunction<T>} LayoutFunction
*/

/**
25 changes: 25 additions & 0 deletions src/robots.txt.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @template T
* @typedef {import('top-bun').TemplateFunction<T>} TemplateFunction
*/

/** @type {TemplateFunction<{
* siteName: string,
* siteDescription: string,
* siteUrl: string,
* authorName: string,
* authorUrl: string,
* authorImgUrl: string
* layout: string,
* publishDate: string
* title: string
* }>} */
export default async ({
vars: {
siteUrl
}
}) => `User-agent: *
Allow: /
Sitemap: ${siteUrl}/sitemap.xml
`
36 changes: 36 additions & 0 deletions src/sitemap.xml.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import builder from 'xmlbuilder'

/**
* @template T
* @typedef {import('top-bun').TemplateFunction<T>} TemplateFunction
*/

/** @type {TemplateFunction<{
* siteName: string,
* siteDescription: string,
* siteUrl: string,
* authorName: string,
* authorUrl: string,
* authorImgUrl: string
* layout: string,
* publishDate: string
* title: string,
* noindex?: boolean
* }>} */
export default async ({
vars: {
siteUrl
},
pages
}) => {
const sitemapObj = {
urlset: {
'@xmlns': 'http://www.sitemaps.org/schemas/sitemap/0.9',
url: pages.filter(page => !page.vars.noindex).map(page => ({
loc: `${siteUrl}/${page.pageInfo.path}${page.pageInfo.path && !page.pageInfo.path.endsWith('.html') ? '/' : ''}`
}))
}
}
const feed = builder.create(sitemapObj, { encoding: 'utf-8' })
return feed.end({ pretty: true, allowEmpty: false })
}

0 comments on commit 681c886

Please sign in to comment.