Demius
Demius
Demius is a local-first Astro blog theme for long-form writing, projects, moments, and visual notes. The production address is https://blog.demius.tech.
Run locally
pnpm install
pnpm devOpen http://localhost:4321.
Build and verify
pnpm check
pnpm build
pnpm previewpnpm build creates the static site, sitemap, RSS feed, and a Pagefind index under dist/.
Local videos are prepared automatically before pnpm dev and pnpm build. The build scans videos under public/, writes four-second HLS segments to public/assets/video-hls/, and preserves each source video's original resolution. Unchanged sources reuse their existing segments. Videos are loaded only when playback is needed; Safari uses native HLS, supported browsers use hls.js, and the original file remains the fallback.
Static hosting should serve .m3u8 as application/vnd.apple.mpegurl and .ts as video/mp2t. Deploy with pnpm build so generated HLS output is present; the generated directory is intentionally ignored by Git.
Content and configuration
- Blog posts live in
src/content/blog/as Markdown or MDX. Migrated Hugo posts are generated undersrc/content/blog/migrated/without changing the source project. - Friend screenshots can be refreshed with
pnpm capture:friends. Each reachable site receives its own local WebP preview, while unavailable sites use the shared fallback image. - Frontmatter is defined in
src/content.config.ts. - Homepage text and links live in
src/config/home.ts. Frequently changed homepage images, wallpaper labels, video paths, and intro copy live together at the top ofsrc/config/home-visuals.ts; fixed dimensions, timings, and effects are kept below. Put source images insrc/assets/home-source/and letpnpm media:preparegenerate the web variants. - Global site name, navigation, metadata, and shared profile information live in
src/config/site.ts. - Global design tokens and responsive styles live in
src/styles/global.css. - Local image assets live in
public/assets/images/andpublic/assets/wallpapers/. - The design contract for extending the theme is documented in
DESIGN.md.
The site URL is configured as https://blog.demius.tech in astro.config.mjs. Update the contact address and GitHub profile in the site config before publishing under a different identity.
Production updates
The private GitHub repository is the production source of truth. The server timer checks main every 30 seconds, builds changed commits in a Node 22 Docker container, keeps a rollback copy, and mirrors dist/ to the 1Panel web root only after a successful build.
pnpm content:migrate
pnpm check
pnpm build
git add .
git commit -m "Update site"
git push origin mainProtected Hugo posts are migrated as metadata-only pages. Their password-, reply-, or shortcode-protected body is intentionally excluded from the generated static site.
Included routes
Home, archive, categories, tags, search, dynamic post pages, moments, projects, gallery with lightbox and filters, friends, links, guestbook demo, tools, about, theme changelog, blog changelog, sponsor, RSS, sitemap, and a custom 404 page.
The theme switch, Ctrl/Cmd + K search panel, mobile navigation drawer, reading progress, article TOC, copy-link action, gallery lightbox, and guestbook/link filters are implemented with small native browser scripts.
