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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ dist-ssr
*.sw?

# Content and generated files
public/index/*json
public/feed*
public/generated/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.9] - 2026-02-22

### Changed

- Moved auto-generated files to `public/generated/` subdirectory for cleaner structure.

## [1.2.8] - 2026-02-20

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions build/calculate-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const publicDir = path.join(__dirname, '..', 'public');
const piecesPagesJsonPath = path.join(publicDir, 'index', 'pieces-pages.json');
const statsJsonPath = path.join(publicDir, 'index', 'stats.json');
const piecesPagesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces-pages.json');
const statsJsonPath = path.join(publicDir, 'generated', 'index', 'stats.json');

try {
const piecesPagesData = JSON.parse(fs.readFileSync(piecesPagesJsonPath, 'utf-8'));
Expand Down
7 changes: 4 additions & 3 deletions build/ensure-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ const contentDir = path.join(publicDir, 'content');
const introPath = path.join(contentDir, 'intro.md');
const piecesDir = path.join(contentDir, 'pieces');
const pagesDir = path.join(contentDir, 'pages');
const indexDir = path.join(publicDir, 'index');
const generatedDir = path.join(publicDir, 'generated');
const indexDir = path.join(generatedDir, 'index');

console.log('\nChecking for missing content...\n');

[contentDir, piecesDir, pagesDir, indexDir].forEach(dir => {
[contentDir, piecesDir, pagesDir, generatedDir, indexDir].forEach(dir => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
console.warn(`WARNING: Directory missing: ${path.basename(dir)}/ — created`);
Expand Down Expand Up @@ -71,7 +72,7 @@ const robotsPath = path.join(publicDir, 'robots.txt');
const siteUrl = config.site?.url?.replace(/\/+$/, '') || 'https://example.com';
const robotsContent = `User-agent: *
Disallow:
Sitemap: ${siteUrl}/sitemap.xml
Sitemap: ${siteUrl}/generated/sitemap.xml
`;
fs.writeFileSync(robotsPath, robotsContent);
console.log('Generated robots.txt');
Expand Down
4 changes: 2 additions & 2 deletions build/generate-body-of-work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import path from 'path';
import yaml from 'js-yaml';

const publicDir = path.join(__dirname, '..', 'public');
const piecesJsonPath = path.join(publicDir, 'index', 'pieces.json');
const collectionsJsonPath = path.join(publicDir, 'index', 'pieces-collections.json');
const piecesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
const collectionsJsonPath = path.join(publicDir, 'generated', 'index', 'pieces-collections.json');
const bodyOfWorkPath = path.join(publicDir, 'content', 'pages', 'body-of-work.md');
const configPath = path.join(publicDir, 'config.yaml');

Expand Down
6 changes: 3 additions & 3 deletions build/generate-rss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const __dirname = path.dirname(__filename);
const publicDir = path.join(__dirname, '..', 'public');
const contentDir = path.join(publicDir, 'content', 'pieces');
const configPath = path.join(publicDir, 'config.yaml');
const piecesJsonPath = path.join(publicDir, 'index', 'pieces.json');
const rssPath = path.join(publicDir, 'feed.xml');
const piecesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
const rssPath = path.join(publicDir, 'generated', 'feed.xml');

interface Piece {
slug: string;
Expand Down Expand Up @@ -77,7 +77,7 @@ interface FrontMatter {
rssLines.push('');
rssLines.push('<channel>');
rssLines.push(` <title>${escapeXml(siteTitle)}</title>`);
rssLines.push(` <atom:link href="${baseUrl}/feed.xml" rel="self" type="application/rss+xml" />`);
rssLines.push(` <atom:link href="${baseUrl}/generated/feed.xml" rel="self" type="application/rss+xml" />`);
rssLines.push(` <link>${baseUrl}/</link>`);
rssLines.push(` <description>${escapeXml(siteTagline)}</description>`);
rssLines.push(` <lastBuildDate>${buildDate}</lastBuildDate>`);
Expand Down
12 changes: 4 additions & 8 deletions build/generate-sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const __dirname = path.dirname(__filename);

const publicDir = path.join(__dirname, '..', 'public');
const configPath = path.join(publicDir, 'config.yaml');
const piecesJsonPath = path.join(publicDir, 'index', 'pieces.json');
const pagesJsonPath = path.join(publicDir, 'index', 'pages.json');
const collectionsJsonPath = path.join(publicDir, 'index', 'pieces-collections.json');
const sitemapPath = path.join(publicDir, 'sitemap.xml');
const piecesJsonPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
const pagesJsonPath = path.join(publicDir, 'generated', 'index', 'pages.json');
const collectionsJsonPath = path.join(publicDir, 'generated', 'index', 'pieces-collections.json');
const sitemapPath = path.join(publicDir, 'generated', 'sitemap.xml');

interface Piece {
slug: string;
Expand Down Expand Up @@ -47,15 +47,13 @@ interface Collection {
sitemapLines.push('<?xml version="1.0" encoding="UTF-8"?>');
sitemapLines.push('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');

// Homepage
sitemapLines.push(' <url>');
sitemapLines.push(` <loc>${baseUrl}/</loc>`);
sitemapLines.push(` <lastmod>${currentDate}</lastmod>`);
sitemapLines.push(' <changefreq>daily</changefreq>');
sitemapLines.push(' <priority>1.0</priority>');
sitemapLines.push(' </url>');

// Pages
for (const page of pages) {
sitemapLines.push(' <url>');
sitemapLines.push(` <loc>${baseUrl}/${page.slug}</loc>`);
Expand All @@ -65,7 +63,6 @@ interface Collection {
sitemapLines.push(' </url>');
}

// Collections/Reader pages
for (const collection of collections) {
sitemapLines.push(' <url>');
sitemapLines.push(` <loc>${baseUrl}/reader/${encodeURIComponent(collection.name)}</loc>`);
Expand All @@ -75,7 +72,6 @@ interface Collection {
sitemapLines.push(' </url>');
}

// Individual pieces
for (const piece of pieces) {
sitemapLines.push(' <url>');
sitemapLines.push(` <loc>${baseUrl}/${piece.slug}</loc>`);
Expand Down
4 changes: 2 additions & 2 deletions build/index-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import yaml from 'js-yaml';

const publicDir = path.join(__dirname, '..', 'public');
const pagesPath = path.join(publicDir, 'content', 'pages');
const indexPath = path.join(publicDir, 'index', 'pages.json');
const errorsPath = path.join(publicDir, 'index', 'page-errors.json');
const indexPath = path.join(publicDir, 'generated', 'index', 'pages.json');
const errorsPath = path.join(publicDir, 'generated', 'index', 'page-errors.json');
const configPath = path.join(publicDir, 'config.yaml');

type Page = {
Expand Down
6 changes: 3 additions & 3 deletions build/index-pieces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import yaml from 'js-yaml';

const publicDir = path.join(__dirname, '..', 'public');
const piecesPath = path.join(publicDir, 'content', 'pieces');
const piecesIndexPath = path.join(publicDir, 'index', 'pieces.json');
const collectionsPath = path.join(publicDir, 'index', 'pieces-collections.json');
const errorsPath = path.join(publicDir, 'index', 'pieces-errors.json');
const piecesIndexPath = path.join(publicDir, 'generated', 'index', 'pieces.json');
const collectionsPath = path.join(publicDir, 'generated', 'index', 'pieces-collections.json');
const errorsPath = path.join(publicDir, 'generated', 'index', 'pieces-errors.json');
const configPath = path.join(publicDir, 'config.yaml');

type Piece = {
Expand Down
4 changes: 2 additions & 2 deletions build/paginate-pieces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import fm from "front-matter";

const publicDir = path.join(__dirname, '..', 'public');
const piecesPath = path.join(publicDir, 'content', 'pieces');
const pagesIndexPath = path.join(publicDir, 'index', 'pieces-pages.json');
const piecesIndexPath = path.join(publicDir, 'index', 'pieces.json');
const pagesIndexPath = path.join(publicDir, 'generated', 'index', 'pieces-pages.json');
const piecesIndexPath = path.join(publicDir, 'generated', 'index', 'pieces.json');

const CHARS_PER_PAGE = 2200;

Expand Down
2 changes: 1 addition & 1 deletion docsite/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const config: Config = {
{
type: 'html',
position: 'right',
value: '<span style="padding: 0.25rem 0.5rem; background: var(--ifm-color-primary); color: white; border-radius: 4px; font-size: 0.875rem; font-weight: 600;">v1.2.8</span>',
value: '<span style="padding: 0.25rem 0.5rem; background: var(--ifm-color-primary); color: white; border-radius: 4px; font-size: 0.875rem; font-weight: 600;">v1.2.9</span>',
},
{
href: 'https://demo.ode.dimwit.me/',
Expand Down
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
Disallow:
Sitemap: https://demo.ode.dimwit.me/generated/sitemap.xml
87 changes: 0 additions & 87 deletions public/sitemap.xml

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/BookViewer/BookViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ function BookViewer() {
setLoading(true);
try {
const [pagesRes, collectionsRes, piecesRes, configData] = await Promise.all([
fetch('/index/pieces-pages.json'),
fetch('/index/pieces-collections.json'),
fetch('/index/pieces.json'),
fetch('/generated/index/pieces-pages.json'),
fetch('/generated/index/pieces-collections.json'),
fetch('/generated/index/pieces.json'),
loadConfig()
]);

Expand Down
2 changes: 1 addition & 1 deletion src/components/HomepageViewer/HomepageViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function HomepageViewer({ siteTitle, siteTagline }) {
setPageContent({ content, frontmatter });

if (contentPath.includes('/pieces/')) {
const piecesResponse = await fetch('/index/pieces.json');
const piecesResponse = await fetch('/generated/index/pieces.json');
const pieces = await piecesResponse.json();
const slug = contentPath.split('/pieces/')[1].replace('.md', '');
const metadata = pieces.find(p => p.slug === slug);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Navigation/Navigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { loadConfig } from '../../utils/loadConfig';


function Navigation() {
const pagesIndexPath = '/index/pages.json';
const piecesIndexPath = '/index/pieces.json';
const pagesIndexPath = '/generated/index/pages.json';
const piecesIndexPath = '/generated/index/pieces.json';
const [pages, setPages] = React.useState([]);
const [pieces, setPieces] = React.useState([]);
const [config, setConfig] = React.useState(null);
Expand Down Expand Up @@ -47,7 +47,7 @@ function Navigation() {
<button onClick={handleRandomPiece} className="random-piece-button">
{config?.ui?.labels?.randomPiece || 'Random Piece'}
</button>
<a href="/feed.xml" target="_blank" rel="noopener noreferrer" className="rss-link">
<a href="/generated/feed.xml" target="_blank" rel="noopener noreferrer" className="rss-link">
{config?.ui?.labels?.rss || 'RSS'}
</a>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Volumes/Volumes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Volumes() {

useEffect(() => {
Promise.all([
fetch('/index/pieces-collections.json').then(r => r.json()),
fetch('/generated/index/pieces-collections.json').then(r => r.json()),
loadConfig()
])
.then(([collectionsData, configData]) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/WordsWasted/WordsWasted.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function WordsWasted() {
useEffect(() => {
Promise.all([
loadConfig(),
fetch('/index/stats.json').then(r => r.json())
fetch('/generated/index/stats.json').then(r => r.json())
])
.then(([configData, statsData]) => {
setConfig(configData);
Expand Down
6 changes: 3 additions & 3 deletions src/utils/resolveContentPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { loadConfig } from './loadConfig';
export async function resolveContentPath({ pathname }) {
if (pathname === '/') {
try {
const res = await fetch('/index/pieces.json');
const res = await fetch('/generated/index/pieces.json');
const pieces = await res.json();
if (pieces && pieces.length > 0) {
const mostRecent = pieces[0];
Expand All @@ -18,7 +18,7 @@ export async function resolveContentPath({ pathname }) {
let isPage = false;
let isPiece = false;
try {
const pagesRes = await fetch('/index/pages.json');
const pagesRes = await fetch('/generated/index/pages.json');
const pages = await pagesRes.json();
isPage = pages.some(page => page.slug === slug);
} catch (error) {
Expand All @@ -27,7 +27,7 @@ export async function resolveContentPath({ pathname }) {
}
if (!isPage) {
try {
const piecesRes = await fetch('/index/pieces.json');
const piecesRes = await fetch('/generated/index/pieces.json');
const pieces = await piecesRes.json();
isPiece = pieces.some(piece => piece.slug === slug);
} catch (error) {
Expand Down