feat: add configurable prefixTags option for tag page titles

Add prefixTags option (default: false) to TagPageOptions. When false,
generated tag pages use only the tag name as title instead of
'Tag: tagname'.
This commit is contained in:
saberzero1 2026-03-18 17:43:32 +01:00
parent 7756ff7deb
commit 49e6c6af86
No known key found for this signature in database
6 changed files with 13 additions and 7 deletions

2
dist/index.d.ts vendored
View file

@ -1,4 +1,4 @@
export { T as TagPage, a as TagPageOptions } from './types-BWrP_Ur0.js';
export { T as TagPage, a as TagPageOptions } from './types-DaI7W9VC.js';
export { TagContent } from './components/index.js';
export { PageGenerator, PageMatcher, QuartzComponent, QuartzComponentConstructor, QuartzComponentProps, QuartzPageTypePlugin, QuartzPageTypePluginInstance, VirtualPage } from '@quartz-community/types';
import './PageList-DncPcZ4-.js';

4
dist/index.js vendored
View file

@ -256,7 +256,7 @@ var TagContent_default = ((opts) => {
var tagMatcher = ({ slug }) => {
return slug.startsWith("tags/") || slug === "tags";
};
var TagPage = () => ({
var TagPage = (opts) => ({
name: "TagPage",
priority: 10,
match: tagMatcher,
@ -278,7 +278,7 @@ var TagPage = () => ({
for (const tag of tags) {
const slug = joinSegments("tags", tag);
if (existingTagSlugs.has(slug)) continue;
const title = tag === "index" ? i18n(locale).pages.tagContent.tagIndex : `${i18n(locale).pages.tagContent.tag}: ${tag}`;
const title = tag === "index" ? i18n(locale).pages.tagContent.tagIndex : opts?.prefixTags ? `${i18n(locale).pages.tagContent.tag}: ${tag}` : tag;
virtualPages.push({
slug,
title,

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -4,6 +4,8 @@ import { S as SortFn } from './PageList-DncPcZ4-.js';
interface TagPageOptions {
sort?: SortFn;
numPages?: number;
/** Show "Tag: " prefix before tag name in generated titles. Default: false */
prefixTags?: boolean;
}
declare const TagPage: QuartzPageTypePlugin<TagPageOptions>;

2
dist/types.d.ts vendored
View file

@ -1,3 +1,3 @@
export { BuildCtx, PageGenerator, PageMatcher, ProcessedContent, QuartzPageTypePlugin, QuartzPageTypePluginInstance, QuartzPluginData, StaticResources, VirtualPage } from '@quartz-community/types';
export { a as TagPageOptions } from './types-BWrP_Ur0.js';
export { a as TagPageOptions } from './types-DaI7W9VC.js';
export { S as SortFn } from './PageList-DncPcZ4-.js';

View file

@ -12,13 +12,15 @@ import type { SortFn } from "./components/PageList";
export interface TagPageOptions {
sort?: SortFn;
numPages?: number;
/** Show "Tag: " prefix before tag name in generated titles. Default: false */
prefixTags?: boolean;
}
const tagMatcher: PageMatcher = ({ slug }) => {
return slug.startsWith("tags/") || slug === "tags";
};
export const TagPage: QuartzPageTypePlugin<TagPageOptions> = () => ({
export const TagPage: QuartzPageTypePlugin<TagPageOptions> = (opts) => ({
name: "TagPage",
priority: 10,
match: tagMatcher,
@ -50,7 +52,9 @@ export const TagPage: QuartzPageTypePlugin<TagPageOptions> = () => ({
const title =
tag === "index"
? i18n(locale).pages.tagContent.tagIndex
: `${i18n(locale).pages.tagContent.tag}: ${tag}`;
: opts?.prefixTags
? `${i18n(locale).pages.tagContent.tag}: ${tag}`
: tag;
virtualPages.push({
slug,