fix: run in docker

This commit is contained in:
Aaron Yarborough 2025-05-02 23:10:34 +01:00
parent f2f3bcb190
commit df3dd52354
6 changed files with 72 additions and 63 deletions

View file

@ -16,29 +16,29 @@ module.exports = {
}
]
},
transform: async (config, path) => {
const metadata = {
loc: path
}
// transform: async (config, path) => {
// const metadata = {
// loc: path
// }
if (isHomepage(path)) {
metadata.priority = 1
} else if (isBasePage(path)) {
metadata.priority = 0.8
} else {
if (isArticle(path)) {
metadata.priority = 0.6
const attributes = getArticleAttibutes(`content${path}.md`)
if (!attributes) { return null }
// if (isHomepage(path)) {
// metadata.priority = 1
// } else if (isBasePage(path)) {
// metadata.priority = 0.8
// } else {
// if (isArticle(path)) {
// metadata.priority = 0.6
// const attributes = getArticleAttibutes(`content${path}.md`)
// if (!attributes) { return null }
metadata.lastmod = attributes.moddate ?? attributes.pubdate ?? null
// metadata.lastmod = attributes.moddate ?? attributes.pubdate ?? null
console.log('Calculated sitemap dates for article', path)
}
}
// console.log('Calculated sitemap dates for article', path)
// }
// }
return metadata
}
// return metadata
// }
}
function isHomepage (path) {

View file

@ -1,42 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://www.aaronjy.me/</loc><priority>1</priority></url>
<url><loc>https://www.aaronjy.me/about/</loc><priority>0.8</priority></url>
<url><loc>https://www.aaronjy.me/cv/</loc><priority>0.8</priority></url>
<url><loc>https://www.aaronjy.me/library/</loc><priority>0.8</priority></url>
<url><loc>https://www.aaronjy.me/tags/</loc><priority>0.8</priority></url>
<url><loc>https://www.aaronjy.me/writing/</loc><priority>0.8</priority></url>
<url><loc>https://www.aaronjy.me/library/1001-Nights/</loc></url>
<url><loc>https://www.aaronjy.me/library/1984/</loc></url>
<url><loc>https://www.aaronjy.me/library/A-Monster-Calls/</loc></url>
<url><loc>https://www.aaronjy.me/library/Childhoods-End/</loc></url>
<url><loc>https://www.aaronjy.me/library/Diary-of-An-Oxygen-Thief/</loc></url>
<url><loc>https://www.aaronjy.me/library/Eleven-Kinds-of-Loneliness-/</loc></url>
<url><loc>https://www.aaronjy.me/library/No-God-But-God/</loc></url>
<url><loc>https://www.aaronjy.me/library/On-Tyranny/</loc></url>
<url><loc>https://www.aaronjy.me/library/Sex--Punishment/</loc></url>
<url><loc>https://www.aaronjy.me/library/The-Alchemist/</loc></url>
<url><loc>https://www.aaronjy.me/library/The-Dangers-of-Smoking-in-Bed-/</loc></url>
<url><loc>https://www.aaronjy.me/library/The-Invisible-Man/</loc></url>
<url><loc>https://www.aaronjy.me/library/The-Nature-of-Alexander/</loc></url>
<url><loc>https://www.aaronjy.me/library/The-Time-Machine/</loc></url>
<url><loc>https://www.aaronjy.me/library/Wintering-The-Power-of-Rest-and-Retreat-in-Difficult-Times/</loc></url>
<url><loc>https://www.aaronjy.me/library/a-night-to-remember/</loc></url>
<url><loc>https://www.aaronjy.me/library/alice-in-wonderland/</loc></url>
<url><loc>https://www.aaronjy.me/library/animal-farm/</loc></url>
<url><loc>https://www.aaronjy.me/library/cities-that-shaped-the-ancient-world/</loc></url>
<url><loc>https://www.aaronjy.me/library/song-of-achilles/</loc></url>
<url><loc>https://www.aaronjy.me/library/starmaker/</loc></url>
<url><loc>https://www.aaronjy.me/library/stasiland/</loc></url>
<url><loc>https://www.aaronjy.me/library/stray-reflections/</loc></url>
<url><loc>https://www.aaronjy.me/library/the-marmalade-diaries/</loc></url>
<url><loc>https://www.aaronjy.me/library/the-midnight-library/</loc></url>
<url><loc>https://www.aaronjy.me/library/to-be-taught-if-fortunate/</loc></url>
<url><loc>https://www.aaronjy.me/library/when-the-moon-hits-your-eye/</loc></url>
<url><loc>https://www.aaronjy.me/writing/attitudes-to-reading/</loc><lastmod>Tue, 18 Mar 2025 00:00:00 GMT</lastmod><priority>0.6</priority></url>
<url><loc>https://www.aaronjy.me/writing/moving-from-github-to-forgejo/</loc><lastmod>Sun, 16 Mar 2025 00:00:00 GMT</lastmod><priority>0.6</priority></url>
<url><loc>https://www.aaronjy.me/writing/performance-considerations-tcp-game-server/</loc><lastmod>Fri, 21 Mar 2025 21:12:47 GMT</lastmod><priority>0.6</priority></url>
<url><loc>https://www.aaronjy.me/writing/quick-reflection-katherine-may/</loc><lastmod>Sun, 09 Mar 2025 00:00:00 GMT</lastmod><priority>0.6</priority></url>
<url><loc>https://www.aaronjy.me/writing/static-site-on-google-cloud/</loc><lastmod>Wed, 01 May 2024 00:00:00 GMT</lastmod><priority>0.6</priority></url>
<url><loc>https://www.aaronjy.me/writing/support-content-file-structure-changes-on-a-static-site/</loc><lastmod>Mon, 18 Mar 2024 16:47:32 GMT</lastmod><priority>0.6</priority></url>
<url><loc>https://www.aaronjy.me/cv</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/tags</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/writing</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/the-alchemist</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/the-invisible-man</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/wintering-the-power-of-rest-and-retreat-in-difficult-times</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/the-time-machine</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/when-the-moon-hits-your-eye</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/the-song-of-achilles</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/to-be-taught-if-fortunate</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/on-tyranny</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/the-dangers-of-smoking-in-bed</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/the-midnight-library</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/a-night-to-remember</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/sex-punishment</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/a-monster-calls</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/diary-of-an-oxygen-thief</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/1984</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/alices-adventures-in-wonderland</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/the-nature-of-alexander</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/eleven-kinds-of-loneliness</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/star-maker</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/stray-reflections</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/stasiland-stories-from-behind-the-berlin-wall</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/cities-that-shaped-the-ancient-world</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/animal-farm</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/one-thousand-and-one-nights-a-retelling</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/library/childhoods-end</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/writing/migrating-from-github-to-forgejo</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/writing/performance-considerations-when-writing-a-tcp-game-server-in-dotnet</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/writing/quickwrite-a-reflection-on-wintering-by-katherine-may</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/writing/deploying-aaronjy-me-on-a-google-storage-bucket</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/writing/supporting-content-file-structure-changes-on-a-static-site</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/writing/attitudes-to-reading-and-how-mine-have-changed</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me/about</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
<url><loc>https://www.aaronjy.me</loc><changefreq>weekly</changefreq><priority>0.7</priority></url>
</urlset>

View file

@ -53,4 +53,4 @@ export class FailedFetchCVError extends Error {
super(`Failed to fetch basic pages: ${msg}`)
this.name = 'FailedFetchCVError'
}
}
}

View file

@ -61,6 +61,10 @@ export async function getStaticProps ({ params }) {
}
export default function BasicPage ({ title, mdxSource }) {
if (!mdxSource || "error" in mdxSource) {
return <p>Something went wrong: {mdxSource?.error ?? "???"}</p>
}
return (
<DefaultLayout>
<NextSeo

View file

@ -21,11 +21,18 @@ export async function getStaticPaths () {
slug: post.slug
}
})),
fallback: true // false or "blocking"
fallback: false // false or "blocking"
}
}
export const getStaticProps = async ({ params }) => {
const { slug } = params
if (!slug) {
return {
notFound: true
}
}
const res = await fetchBookReviews([], {
slug,
status: 'published'

View file

@ -10,7 +10,7 @@ export const fetchCV = async (...args) => fetchItems('cv', ...args)
export async function fetchItems (type, fields = undefined, filter = undefined) {
const url = new URL(`${baseUrl}/items/${type}`)
console.log(`Getting items '${type}' with fields`, fields, 'and filter', filter)
// console.trace(`Getting items '${type}' with fields`, fields, 'and filter', filter)
if (fields?.length) {
url.searchParams.append('fields', fields.join(','))
@ -50,9 +50,9 @@ export function markdownToHtml (content) {
}
async function apiFetch (...args) {
console.log('API fetch:', args)
const url = args[0]
// @ts-ignore
const res = await fetch(...args)
console.log('API fetch response:', res.status, res.statusText)
// console.log('GET (fetch)', url, res.status, res.statusText)
return res
}