Site Basic Information & Content Collections

🕒 Reading time: 5 min📝 Words: 1104👀 Views: Loading...

View Markdown source

site.yml — Site Identity

File: stalux/config/site.yml

id: site
lang: en # Language: "en" | "zh-CN"
title: Stalux Blog Theme # Site title
url: https://stalux.needhelp.icu # Site URL (used for canonical, RSS, OpenGraph)
description: "Blog theme Stalux ..." # Site description (SEO, OpenGraph)
accentColor: "#FFD76A" # Optional shared theme and Waline accent; six-digit HEX
timezone: "Asia/Shanghai" # IANA timezone; used for both formatting and parsing naive frontmatter dates (1.41.2+)
favicon: "/stalux.ico" # Favicon path
canonical: "https://stalux.needhelp.icu" # Canonical URL (optional, falls back to url)
# twitterSite: # Twitter/X site handle (optional)
# noindex: false # Global noindex (optional, default false)
# nofollow: false # Global nofollow (optional, default false)

accentColor defaults to #FFD76A and accepts #RRGGBB. Stalux derives light fills and dark ink in Oklab for article tags, categories, the Markdown source badge, and search highlights. The same setting also sets the Waline accent.

This setting is optional: leave it out to keep the default, and existing site.yml files do not need to be edited. Stalux applies the default while reading site configuration as well as when generating color tokens, because Astro’s YAML content collection may omit Zod defaults from runtime data. This compatibility fix is included in Stalux v1.29.1. In v1.29.0, a consumer build with accentColor omitted could fail while rendering /404 with an undefined accent color.

astro.config.ts — Trailing Slashes

Set trailingSlash in the site’s existing Astro configuration. Starting with Stalux v1.61.0, the theme reads this setting when the site builds.

astro.config.ts
import { defineConfig } from "astro/config";
import stalux from "@xingwangzhe/stalux";
export default defineConfig({
trailingSlash: "always",
build: { format: "directory" },
integrations: [stalux()],
});
Setting Canonical archive URL
"never" /archives
"always" /archives/
"ignore" or omitted /archives

With build.format: "directory", Astro writes dist/archives/index.html and sets Astro.url.pathname to /archives/ during the build. A relative URL such as new URL("./child", Astro.url) resolves to /archives/child.

Stalux uses the same URL style for navigation and article links, canonical and Open Graph tags, structured data, RSS, sitemap, and Waline comment paths. The homepage stays at /, and file endpoints such as /rss.xml keep their own paths.

Rebuild and deploy the site to apply a change. Check that your static host serves the chosen URLs. If the site already has Waline comments, check whether you need to migrate the stored paths before switching.

author.yml — Author Information

File: stalux/config/author.yml

id: author
name: xingwangzhe # Display name
avatar: /avatar.png # Avatar path
bio: Blog Theme Stalux # Short bio
jobTitle: Software Engineer # Optional public role, emitted in JSON-LD Person

Rendered on: post sidebars, homepage author card, and SEO JSON-LD. jobTitle is optional and is emitted only in the JSON-LD Person entity; it does not change the visual author card.

Content Collections

Content is managed through Astro’s astro:content system under the stalux/ directory:

Terminal window
stalux/
├── posts/ # Blog posts (.md / .mdx)
├── about/ # About pages (.md / .mdx)
├── words/ # Quotes & snippets (.md)
└── config/ # Theme configuration (.yml)

Posts (stalux/posts/*.md)

Required frontmatter:

Field Type Description
title string Post title
abbrlink string|number Permanent link ID, generates /posts/{abbrlink} route
date string Publish time, ISO 8601 or YYYY-MM-DD HH:mm:ss
desc string Post description for SEO/OG. Must be manually written, 50–160 chars recommended

Optional frontmatter:

Field Type Default Description
searchKeywords string[] empty Optional public search aliases; indexed in the public Orama artifact. Never include secrets.
updated string — Update time
draft boolean false Hide from published lists
tags string[] — Tag array (single string auto-converted)
categories string[] — Category array
cc string CC-BY-NC-SA-4.0 License
cover string — Post cover image URL/path

Example:

---
title: Sample Post
abbrlink: sample-post
date: 2025-05-10T12:00:00+08:00
desc: A short description for SEO and preview cards.
updated: 2025-05-12T09:00:00+08:00
tags: [Tech, Essay]
categories: [Frontend]
cc: CC-BY-NC-SA-4.0
draft: false
cover: /images/cover.jpg
og:image: /images/custom-social-card.png # Optional: overrides the generated sharing card
---
Post body...

About (stalux/about/*.md)

Required: title (page title), description (page description).

Words (stalux/words/*.md)

Optional frontmatter: source, link, sourceDate, date, updated, draft.

Writing Notes

Guideline Detail
Delimiter Wrap frontmatter between ---
Date format Zero-padding is mandatory and enforced by the schema since 1.41.4: 2026-6-9 9:11:00 fails the build; write 2026-06-09 09:11:00. Allowed: "YYYY-MM-DD HH:mm:ss" (recommended), date-only YYYY-MM-DD, or ISO 8601 with an explicit timezone offset. Naive (no-offset) values are parsed in the site timezone from site.yml, so build machines in any timezone produce identical RSS/Atom/JSON-LD times
Permalinks Choose stable custom abbrlink values (independent of title changes)
Descriptions Must be meaningful for SEO and social share cards

Visitor weather is optional: set weather: { enabled: true } in stalux/config/site.yml to show it as plain text in the footer (with visitor IP and approximate location) and below the desktop article clock. Omitted or false disables it. It automatically requests an approximate city from IP.SB (with IPinfo as fallback) and weather from Open-Meteo, only while visible; no browser GPS permission is requested. These external services receive the visitor IP, and Open-Meteo receives rounded coordinates. A 20-minute session cache stores the city, visitor IP and weather, without coordinates. Visitors behind VPNs may see the exit city. Hidden tabs, offscreen cards and Astro navigation stop work; unavailable services show a retry action and retain previous weather. Open-Meteo’s free endpoint is for non-commercial use subject to its limits; the card links to its attribution licence. No server endpoint or extra package is needed.