@geekity/cms 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -4
- package/admin/pages/account/login.njk +3 -0
- package/admin/pages/documents/editor.njk +7 -0
- package/admin/pages/indieauth/consent.njk +51 -0
- package/admin/pages/indieauth/refused.njk +11 -0
- package/admin/pages/settings/general.njk +9 -0
- package/admin/pages/settings/reading.njk +93 -0
- package/admin/pages/users/apps.njk +74 -0
- package/admin/pages/users/edit.njk +12 -0
- package/admin/static/admin.css +27 -0
- package/dist/admin/accounts.d.ts +3 -0
- package/dist/admin/accounts.d.ts.map +1 -1
- package/dist/admin/accounts.js +5 -0
- package/dist/admin/accounts.js.map +1 -1
- package/dist/admin/documents.d.ts +2 -0
- package/dist/admin/documents.d.ts.map +1 -1
- package/dist/admin/documents.js +17 -1
- package/dist/admin/documents.js.map +1 -1
- package/dist/admin/headers.d.ts +5 -1
- package/dist/admin/headers.d.ts.map +1 -1
- package/dist/admin/headers.js +7 -3
- package/dist/admin/headers.js.map +1 -1
- package/dist/admin/menu.d.ts.map +1 -1
- package/dist/admin/menu.js +2 -1
- package/dist/admin/menu.js.map +1 -1
- package/dist/admin/routes.d.ts.map +1 -1
- package/dist/admin/routes.js +48 -5
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/settings-general.js +1 -1
- package/dist/admin/settings-general.js.map +1 -1
- package/dist/admin/settings-reading.d.ts.map +1 -1
- package/dist/admin/settings-reading.js +15 -1
- package/dist/admin/settings-reading.js.map +1 -1
- package/dist/admin/settings.d.ts +79 -2
- package/dist/admin/settings.d.ts.map +1 -1
- package/dist/admin/settings.js +168 -2
- package/dist/admin/settings.js.map +1 -1
- package/dist/admin/templates.d.ts +3 -0
- package/dist/admin/templates.d.ts.map +1 -1
- package/dist/admin/templates.js +3 -0
- package/dist/admin/templates.js.map +1 -1
- package/dist/admin/users.d.ts +8 -0
- package/dist/admin/users.d.ts.map +1 -1
- package/dist/admin/users.js +9 -0
- package/dist/admin/users.js.map +1 -1
- package/dist/config.d.ts +30 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/env.d.ts +14 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/federation/article.d.ts.map +1 -1
- package/dist/federation/article.js +18 -5
- package/dist/federation/article.js.map +1 -1
- package/dist/images/icons.d.ts +44 -25
- package/dist/images/icons.d.ts.map +1 -1
- package/dist/images/icons.js +205 -60
- package/dist/images/icons.js.map +1 -1
- package/dist/images/index.d.ts +2 -2
- package/dist/images/index.d.ts.map +1 -1
- package/dist/images/index.js +1 -1
- package/dist/images/index.js.map +1 -1
- package/dist/images/markup.d.ts +14 -0
- package/dist/images/markup.d.ts.map +1 -1
- package/dist/images/markup.js +16 -11
- package/dist/images/markup.js.map +1 -1
- package/dist/images/variants.d.ts.map +1 -1
- package/dist/images/variants.js +3 -4
- package/dist/images/variants.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/indexnow.d.ts +34 -0
- package/dist/indexnow.d.ts.map +1 -0
- package/dist/indexnow.js +141 -0
- package/dist/indexnow.js.map +1 -0
- package/dist/indieauth/bearer.d.ts +39 -0
- package/dist/indieauth/bearer.d.ts.map +1 -0
- package/dist/indieauth/bearer.js +63 -0
- package/dist/indieauth/bearer.js.map +1 -0
- package/dist/indieauth/client.d.ts +61 -0
- package/dist/indieauth/client.d.ts.map +1 -0
- package/dist/indieauth/client.js +139 -0
- package/dist/indieauth/client.js.map +1 -0
- package/dist/indieauth/connected-apps.d.ts +23 -0
- package/dist/indieauth/connected-apps.d.ts.map +1 -0
- package/dist/indieauth/connected-apps.js +73 -0
- package/dist/indieauth/connected-apps.js.map +1 -0
- package/dist/indieauth/consent.d.ts +28 -0
- package/dist/indieauth/consent.d.ts.map +1 -0
- package/dist/indieauth/consent.js +185 -0
- package/dist/indieauth/consent.js.map +1 -0
- package/dist/indieauth/discovery.d.ts +87 -0
- package/dist/indieauth/discovery.d.ts.map +1 -0
- package/dist/indieauth/discovery.js +127 -0
- package/dist/indieauth/discovery.js.map +1 -0
- package/dist/indieauth/grants.d.ts +57 -0
- package/dist/indieauth/grants.d.ts.map +1 -0
- package/dist/indieauth/grants.js +35 -0
- package/dist/indieauth/grants.js.map +1 -0
- package/dist/indieauth/identity.d.ts +36 -0
- package/dist/indieauth/identity.d.ts.map +1 -0
- package/dist/indieauth/identity.js +78 -0
- package/dist/indieauth/identity.js.map +1 -0
- package/dist/indieauth/redeem.d.ts +47 -0
- package/dist/indieauth/redeem.d.ts.map +1 -0
- package/dist/indieauth/redeem.js +69 -0
- package/dist/indieauth/redeem.js.map +1 -0
- package/dist/indieauth/request.d.ts +47 -0
- package/dist/indieauth/request.d.ts.map +1 -0
- package/dist/indieauth/request.js +104 -0
- package/dist/indieauth/request.js.map +1 -0
- package/dist/indieauth/token.d.ts +19 -0
- package/dist/indieauth/token.d.ts.map +1 -0
- package/dist/indieauth/token.js +110 -0
- package/dist/indieauth/token.js.map +1 -0
- package/dist/indieauth/tokens.d.ts +131 -0
- package/dist/indieauth/tokens.d.ts.map +1 -0
- package/dist/indieauth/tokens.js +205 -0
- package/dist/indieauth/tokens.js.map +1 -0
- package/dist/web/archive.d.ts +1 -1
- package/dist/web/archive.d.ts.map +1 -1
- package/dist/web/archive.js +3 -2
- package/dist/web/archive.js.map +1 -1
- package/dist/web/context.d.ts +25 -0
- package/dist/web/context.d.ts.map +1 -1
- package/dist/web/context.js +18 -0
- package/dist/web/context.js.map +1 -1
- package/dist/web/feed-atom.d.ts.map +1 -1
- package/dist/web/feed-atom.js +3 -1
- package/dist/web/feed-atom.js.map +1 -1
- package/dist/web/feed-item.d.ts +11 -2
- package/dist/web/feed-item.d.ts.map +1 -1
- package/dist/web/feed-item.js +9 -3
- package/dist/web/feed-item.js.map +1 -1
- package/dist/web/feed-json.d.ts +4 -0
- package/dist/web/feed-json.d.ts.map +1 -1
- package/dist/web/feed-json.js +4 -1
- package/dist/web/feed-json.js.map +1 -1
- package/dist/web/feed-rss.d.ts.map +1 -1
- package/dist/web/feed-rss.js +16 -3
- package/dist/web/feed-rss.js.map +1 -1
- package/dist/web/feed-source.d.ts +28 -0
- package/dist/web/feed-source.d.ts.map +1 -1
- package/dist/web/feed-source.js +31 -0
- package/dist/web/feed-source.js.map +1 -1
- package/dist/web/feed-xml.d.ts +2 -0
- package/dist/web/feed-xml.d.ts.map +1 -1
- package/dist/web/feed-xml.js +2 -0
- package/dist/web/feed-xml.js.map +1 -1
- package/dist/web/feeds.d.ts.map +1 -1
- package/dist/web/feeds.js +8 -1
- package/dist/web/feeds.js.map +1 -1
- package/dist/web/index.d.ts +3 -1
- package/dist/web/index.d.ts.map +1 -1
- package/dist/web/index.js +2 -1
- package/dist/web/index.js.map +1 -1
- package/dist/web/indexnow.d.ts +9 -0
- package/dist/web/indexnow.d.ts.map +1 -0
- package/dist/web/indexnow.js +27 -0
- package/dist/web/indexnow.js.map +1 -0
- package/dist/web/llms.d.ts +58 -0
- package/dist/web/llms.d.ts.map +1 -0
- package/dist/web/llms.js +91 -0
- package/dist/web/llms.js.map +1 -0
- package/dist/web/locale.d.ts +41 -0
- package/dist/web/locale.d.ts.map +1 -0
- package/dist/web/locale.js +56 -0
- package/dist/web/locale.js.map +1 -0
- package/dist/web/manifest.d.ts +50 -0
- package/dist/web/manifest.d.ts.map +1 -0
- package/dist/web/manifest.js +56 -0
- package/dist/web/manifest.js.map +1 -0
- package/dist/web/negotiate.d.ts.map +1 -1
- package/dist/web/negotiate.js +6 -0
- package/dist/web/negotiate.js.map +1 -1
- package/dist/web/render.d.ts +6 -1
- package/dist/web/render.d.ts.map +1 -1
- package/dist/web/render.js +41 -10
- package/dist/web/render.js.map +1 -1
- package/dist/web/robots.d.ts +89 -0
- package/dist/web/robots.d.ts.map +1 -0
- package/dist/web/robots.js +259 -0
- package/dist/web/robots.js.map +1 -0
- package/dist/web/routes.d.ts.map +1 -1
- package/dist/web/routes.js +105 -6
- package/dist/web/routes.js.map +1 -1
- package/dist/web/share-image.d.ts +51 -0
- package/dist/web/share-image.d.ts.map +1 -0
- package/dist/web/share-image.js +43 -0
- package/dist/web/share-image.js.map +1 -0
- package/dist/web/sitemap.d.ts +0 -26
- package/dist/web/sitemap.d.ts.map +1 -1
- package/dist/web/sitemap.js +0 -44
- package/dist/web/sitemap.js.map +1 -1
- package/dist/web/templates.d.ts +16 -9
- package/dist/web/templates.d.ts.map +1 -1
- package/dist/web/templates.js +83 -55
- package/dist/web/templates.js.map +1 -1
- package/dist/web/themes.d.ts +33 -0
- package/dist/web/themes.d.ts.map +1 -1
- package/dist/web/themes.js +57 -0
- package/dist/web/themes.js.map +1 -1
- package/dist/webmention/discovery.d.ts +4 -2
- package/dist/webmention/discovery.d.ts.map +1 -1
- package/dist/webmention/discovery.js +14 -8
- package/dist/webmention/discovery.js.map +1 -1
- package/dist/webmention/fetch-public.d.ts +2 -0
- package/dist/webmention/fetch-public.d.ts.map +1 -1
- package/dist/webmention/fetch-public.js +1 -1
- package/dist/webmention/fetch-public.js.map +1 -1
- package/package.json +1 -1
- package/themes/default/README.md +119 -29
- package/themes/default/layouts/base.njk +95 -16
- package/themes/default/layouts/front-page.njk +6 -1
- package/themes/default/layouts/home.njk +10 -0
- package/themes/default/layouts/page.njk +4 -3
- package/themes/default/layouts/post.njk +5 -4
- package/themes/default/layouts/search.njk +4 -5
- package/themes/default/partials/archive.njk +3 -1
- package/themes/default/partials/bio.njk +9 -2
- package/themes/default/partials/breadcrumbs.njk +20 -0
- package/themes/default/partials/conversation.njk +4 -1
- package/themes/default/partials/jsonld.njk +19 -4
- package/themes/default/partials/kicker.njk +6 -4
- package/themes/default/partials/lang.njk +7 -0
- package/themes/default/partials/post-list.njk +5 -3
- package/themes/default/partials/reply-context.njk +4 -2
- package/themes/default/src/style.css +14 -0
- package/themes/default/static/style.css +53 -0
- package/themes/default/theme.json +2 -0
package/dist/web/themes.js
CHANGED
|
@@ -33,6 +33,19 @@ export const THEME_MANIFEST_FILE = 'theme.json';
|
|
|
33
33
|
* loaded as a site theme by accident.
|
|
34
34
|
*/
|
|
35
35
|
export const SITE_THEME_KIND = 'site';
|
|
36
|
+
/**
|
|
37
|
+
* What the `color-scheme` meta may say (TASK-146): the schemes a theme draws,
|
|
38
|
+
* the one it prefers first. `only dark` is not among them because the HTML
|
|
39
|
+
* standard does not allow it.
|
|
40
|
+
*/
|
|
41
|
+
export const COLOR_SCHEMES = [
|
|
42
|
+
'normal',
|
|
43
|
+
'light',
|
|
44
|
+
'dark',
|
|
45
|
+
'light dark',
|
|
46
|
+
'dark light',
|
|
47
|
+
'only light',
|
|
48
|
+
];
|
|
36
49
|
/**
|
|
37
50
|
* Read one directory as a theme.
|
|
38
51
|
*
|
|
@@ -90,9 +103,49 @@ export function readTheme(dir) {
|
|
|
90
103
|
? { description: description.trim() }
|
|
91
104
|
: {}),
|
|
92
105
|
areas: themeAreasOf(manifest['areas']),
|
|
106
|
+
colors: themeColorsOf(manifest['colorScheme'], manifest['themeColor']),
|
|
93
107
|
},
|
|
94
108
|
};
|
|
95
109
|
}
|
|
110
|
+
const HEX_COLOR = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
111
|
+
/**
|
|
112
|
+
* The colours a manifest declares, leaving out any it got wrong.
|
|
113
|
+
*
|
|
114
|
+
* Tolerant for the reason {@link themeAreasOf} is: a colour a browser would
|
|
115
|
+
* not take costs the site a tinted address bar, not its pages.
|
|
116
|
+
*/
|
|
117
|
+
function themeColorsOf(scheme, color) {
|
|
118
|
+
const declared = typeof color === 'object' && color !== null ? color : {};
|
|
119
|
+
const hex = (value) => typeof value === 'string' && HEX_COLOR.test(value) ? value : undefined;
|
|
120
|
+
const light = hex(declared['light']);
|
|
121
|
+
const dark = hex(declared['dark']);
|
|
122
|
+
return {
|
|
123
|
+
...(COLOR_SCHEMES.includes(scheme)
|
|
124
|
+
? { colorScheme: scheme }
|
|
125
|
+
: {}),
|
|
126
|
+
themeColor: {
|
|
127
|
+
...(light === undefined ? {} : { light }),
|
|
128
|
+
...(dark === undefined ? {} : { dark }),
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A chosen theme's colours, each one it leaves out taken from the packaged
|
|
134
|
+
* theme: a site theme is laid over the packaged one a file at a time, and it
|
|
135
|
+
* keeps the packaged stylesheet until it ships its own, so it keeps the
|
|
136
|
+
* packaged colours until it declares its own.
|
|
137
|
+
*/
|
|
138
|
+
function resolvedColors(theme) {
|
|
139
|
+
const packaged = readTheme(PACKAGED_THEME_DIR);
|
|
140
|
+
const base = packaged.ok ? packaged.theme.colors : { themeColor: {} };
|
|
141
|
+
if (theme === undefined)
|
|
142
|
+
return base;
|
|
143
|
+
const scheme = theme.colors.colorScheme ?? base.colorScheme;
|
|
144
|
+
return {
|
|
145
|
+
...(scheme === undefined ? {} : { colorScheme: scheme }),
|
|
146
|
+
themeColor: { ...base.themeColor, ...theme.colors.themeColor },
|
|
147
|
+
};
|
|
148
|
+
}
|
|
96
149
|
/**
|
|
97
150
|
* An `areas` value as the areas it declares, ignoring anything that is not
|
|
98
151
|
* one.
|
|
@@ -213,6 +266,10 @@ export function themeNameProblem(name) {
|
|
|
213
266
|
* a site that 500s on every page because of a directory rename.
|
|
214
267
|
*/
|
|
215
268
|
export function chooseTheme(options) {
|
|
269
|
+
const chosen = chooseThemeDirs(options);
|
|
270
|
+
return { ...chosen, colors: resolvedColors(chosen.theme) };
|
|
271
|
+
}
|
|
272
|
+
function chooseThemeDirs(options) {
|
|
216
273
|
const name = options.name.trim();
|
|
217
274
|
if (name === '')
|
|
218
275
|
return { theme: undefined, dirs: themeSearchPath(), problem: undefined };
|
package/dist/web/themes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.js","sourceRoot":"","sources":["../../src/web/themes.ts"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
24
|
*/
|
|
25
25
|
export declare function discoverEndpoint(target: string): Promise<string | undefined>;
|
|
26
|
+
/** The endpoint one or more `Link` headers name, or `undefined`. */
|
|
27
|
+
export declare function endpointInHeader(header: string | null, base: string): string | undefined;
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
29
|
+
* Every target a `Link` header names for `rel`, in order and unresolved.
|
|
28
30
|
*
|
|
29
31
|
* A header may carry several links separated by commas and each may name
|
|
30
32
|
* several relations, so both are split. Splitting on commas that are not
|
|
31
33
|
* inside angle brackets or quotes is what keeps a URL holding a comma — which
|
|
32
34
|
* is legal — from being torn in half.
|
|
33
35
|
*/
|
|
34
|
-
export declare function
|
|
36
|
+
export declare function linkTargets(header: string | null, rel: string): string[];
|
|
35
37
|
/**
|
|
36
38
|
* The endpoint a page's markup names, or `undefined`.
|
|
37
39
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/webmention/discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,UAAY,CAAC;AAE7C,gCAAgC;AAChC,eAAO,MAAM,qBAAqB,0DAA0D,CAAC;AAE7F;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkClF;AAED
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/webmention/discovery.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,UAAY,CAAC;AAE7C,gCAAgC;AAChC,eAAO,MAAM,qBAAqB,0DAA0D,CAAC;AAE7F;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAkClF;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGxF;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBxE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW7E;AAsCD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BpE"}
|
|
@@ -55,28 +55,34 @@ export async function discoverEndpoint(target) {
|
|
|
55
55
|
}
|
|
56
56
|
return endpointInHtml(await readCapped(response), arrivedAt);
|
|
57
57
|
}
|
|
58
|
+
/** The endpoint one or more `Link` headers name, or `undefined`. */
|
|
59
|
+
export function endpointInHeader(header, base) {
|
|
60
|
+
const [target] = linkTargets(header, 'webmention');
|
|
61
|
+
return target === undefined ? undefined : resolve(target, base);
|
|
62
|
+
}
|
|
58
63
|
/**
|
|
59
|
-
*
|
|
64
|
+
* Every target a `Link` header names for `rel`, in order and unresolved.
|
|
60
65
|
*
|
|
61
66
|
* A header may carry several links separated by commas and each may name
|
|
62
67
|
* several relations, so both are split. Splitting on commas that are not
|
|
63
68
|
* inside angle brackets or quotes is what keeps a URL holding a comma — which
|
|
64
69
|
* is legal — from being torn in half.
|
|
65
70
|
*/
|
|
66
|
-
export function
|
|
71
|
+
export function linkTargets(header, rel) {
|
|
67
72
|
if (header === null)
|
|
68
|
-
return
|
|
73
|
+
return [];
|
|
74
|
+
const targets = [];
|
|
69
75
|
for (const value of splitLinkHeader(header)) {
|
|
70
76
|
const match = /^\s*<([^>]*)>\s*(.*)$/.exec(value);
|
|
71
77
|
if (match === null)
|
|
72
78
|
continue;
|
|
73
79
|
const relations = /(?:^|;)\s*rel\s*=\s*("([^"]*)"|'([^']*)'|([^;\s]*))/i.exec(match[2] ?? '');
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
const names = relations?.[2] ?? relations?.[3] ?? relations?.[4] ?? '';
|
|
81
|
+
if (names.split(/\s+/).some((token) => token.toLowerCase() === rel)) {
|
|
82
|
+
targets.push(match[1] ?? '');
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
|
-
return
|
|
85
|
+
return targets;
|
|
80
86
|
}
|
|
81
87
|
/**
|
|
82
88
|
* The endpoint a page's markup names, or `undefined`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/webmention/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1D;;;;;;;;;GASG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAE3C,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C,gCAAgC;AAChC,MAAM,CAAC,MAAM,qBAAqB,GAAG,uDAAuD,CAAC;AAE7F;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,MAAc;IACnD,IAAI,QAAkB,CAAC;IACvB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE;YAC7B,OAAO,EAAE,EAAE,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,qBAAqB,EAAE;YAChF,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC;SAClD,CAAC,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IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACrD,IAAI,IAAI,IAAI,mBAAmB;gBAAE,MAAM;QACzC,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;IACxE,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,MAAM;IACb,wEAAwE;AAC1E,CAAC"}
|
|
@@ -22,6 +22,8 @@ export type PublicFetch = {
|
|
|
22
22
|
readonly url: string;
|
|
23
23
|
/** The response's `Content-Type`. */
|
|
24
24
|
readonly type: string;
|
|
25
|
+
/** The response's `Link` header, or `null` when it sent none. */
|
|
26
|
+
readonly link: string | null;
|
|
25
27
|
readonly body: Uint8Array;
|
|
26
28
|
} | {
|
|
27
29
|
readonly ok: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-public.d.ts","sourceRoot":"","sources":["../../src/webmention/fetch-public.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAetD,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE;QAAE,QAAQ,CA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AC3E;AAED,8BAA8B;AAC9B,MAAM,MAAM,WAAW,GACnB;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,uDAAuD;IACvD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,GACD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,uDAAuD;AACvD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC,CA6CtB;AAED,wDAAwD;AACxD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CASrD"}
|
|
@@ -48,7 +48,7 @@ export async function fetchPublic(target, options) {
|
|
|
48
48
|
const body = await readWithin(response, options.maxBytes);
|
|
49
49
|
if (body === undefined)
|
|
50
50
|
return refuse(`larger than ${String(options.maxBytes)} bytes`);
|
|
51
|
-
return { ok: true, url: url.href, type, body };
|
|
51
|
+
return { ok: true, url: url.href, type, link: response.headers.get('link'), body };
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
catch (thrown) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-public.js","sourceRoot":"","sources":["../../src/webmention/fetch-public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;;;;;;;GAQG;AAEH,wEAAwE;AACxE,MAAM,aAAa,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version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M;QACtB,MAAM,KAAK,GAAe,KAAK,CAAC,KAAK,CAAC;QACtC,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC;QACrB,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;YACpB,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;YACtB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,MAAM,CAAC,MAAc;IAC5B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC"}
|
package/package.json
CHANGED
package/themes/default/README.md
CHANGED
|
@@ -83,7 +83,9 @@ overrides the `--color-*` custom properties instead; see [Colours](#colours).
|
|
|
83
83
|
{
|
|
84
84
|
"name": "Default",
|
|
85
85
|
"kind": "site",
|
|
86
|
-
"description": "One line about the theme."
|
|
86
|
+
"description": "One line about the theme.",
|
|
87
|
+
"colorScheme": "light dark",
|
|
88
|
+
"themeColor": { "light": "#faf7f2", "dark": "#171412" }
|
|
87
89
|
}
|
|
88
90
|
```
|
|
89
91
|
|
|
@@ -93,6 +95,14 @@ and `description` is optional. The directory name is the theme's id. A
|
|
|
93
95
|
directory without a readable manifest, or one naming a kind this CMS does not
|
|
94
96
|
have, is not a theme.
|
|
95
97
|
|
|
98
|
+
`colorScheme` and `themeColor` are the colours the head declares before the
|
|
99
|
+
stylesheet loads (see [The head](#the-head)). `colorScheme` is one of `normal`,
|
|
100
|
+
`light`, `dark`, `light dark`, `dark light` or `only light`, preferred scheme
|
|
101
|
+
first. `themeColor` is the colour of the browser around the page, one per
|
|
102
|
+
scheme, as a three- or six-digit hex colour with no alpha. Make it the page's
|
|
103
|
+
own background. A value outside those is ignored, and so is one a theme leaves
|
|
104
|
+
out: each falls back to this theme's, just as a template does.
|
|
105
|
+
|
|
96
106
|
## Overriding a template
|
|
97
107
|
|
|
98
108
|
A site keeps its themes under one directory, `themes/` by default and
|
|
@@ -151,8 +161,8 @@ packaged ones by name:
|
|
|
151
161
|
```
|
|
152
162
|
|
|
153
163
|
`layouts/base.njk` defines the blocks `title`, `speculationRules`,
|
|
154
|
-
`viewTransitions`, `head`, `alternates`, `header`, `
|
|
155
|
-
`scripts`, so most sites never have to copy it.
|
|
164
|
+
`viewTransitions`, `head`, `alternates`, `header`, `breadcrumbs`, `content`,
|
|
165
|
+
`footer` and `scripts`, so most sites never have to copy it.
|
|
156
166
|
|
|
157
167
|
Two layouts are named for the pages the Reading settings pick:
|
|
158
168
|
|
|
@@ -206,6 +216,18 @@ and the copyright line stands on its own. The year is
|
|
|
206
216
|
rather than parses — so it is the year at the moment the page is rendered, in
|
|
207
217
|
the site's own timezone.
|
|
208
218
|
|
|
219
|
+
**The breadcrumb** opens `<main>` on a page with a place in the site's
|
|
220
|
+
hierarchy (TASK-150): a post filed under a category, and a category, tag or
|
|
221
|
+
author archive. It is `nav.breadcrumbs` labelled `Breadcrumb`, holding an `ol`
|
|
222
|
+
whose items run Home, then the post's first category and the post, or the
|
|
223
|
+
archive's term or person, then `Page N` past page one. Every crumb but the last
|
|
224
|
+
is a link; the last is the page itself, a `span` with `aria-current="page"`.
|
|
225
|
+
The trail is `breadcrumbs`, a list of `{ name, url }` that `layouts/base.njk`
|
|
226
|
+
sets before anything is printed, and the JSON-LD prints the same list, so the
|
|
227
|
+
two cannot disagree. Every other page has an empty trail and prints nothing. A
|
|
228
|
+
site that wants no visible breadcrumb empties the `breadcrumbs` block, and the
|
|
229
|
+
`BreadcrumbList` stays in the graph.
|
|
230
|
+
|
|
209
231
|
Webrings, badges, a licence notice and anything else that is markup rather than
|
|
210
232
|
a link are deliberately not in the package. They go in a site theme's `footer`
|
|
211
233
|
block:
|
|
@@ -405,7 +427,16 @@ What the bio prints: a round `u-photo` at 50px when they have an avatar,
|
|
|
405
427
|
their archive, then `p-job-title` and `p-locality` when the profile says, then
|
|
406
428
|
their `p-note` and their `rel="me"` links as a `ul.hlist.bio-links` — each
|
|
407
429
|
link's `rel` is on it ready to print, `me` first and then whatever else the
|
|
408
|
-
Links box typed.
|
|
430
|
+
Links box typed. Set `bioRelMe` to `false` to keep the card and drop its
|
|
431
|
+
claims: the name is linked `rel="author"` alone and `me` comes off every
|
|
432
|
+
link.
|
|
433
|
+
|
|
434
|
+
**The homepage** speaks for the site's author only on a solo author blog,
|
|
435
|
+
which `soloAuthor` on the context says. Then both `layouts/home.njk` at `/` and
|
|
436
|
+
`layouts/front-page.njk` end with that person's card, with its `rel="me"`
|
|
437
|
+
claims, and their author archive's link home carries `rel="me"` back, so the
|
|
438
|
+
homepage and the archive name each other. On any other site a listing homepage
|
|
439
|
+
prints no card, and the front page prints its card with `bioRelMe` false. Each of
|
|
409
440
|
those is printed only when the profile says it, so a profile holding a name
|
|
410
441
|
alone prints a name alone. A name this site has no account for is printed
|
|
411
442
|
unlinked, because the file still said somebody wrote this.
|
|
@@ -656,25 +687,52 @@ the entry's `summary` — the line the feeds publish — else `site.tagline`. It
|
|
|
656
687
|
printed once, as `<meta name="description">`, and the Open Graph and Twitter
|
|
657
688
|
descriptions say the same thing.
|
|
658
689
|
|
|
690
|
+
**The colours** come from the theme's `theme.json` (see
|
|
691
|
+
[The manifest](#the-manifest)), on the context as `theme`.
|
|
692
|
+
`<meta name="color-scheme">` comes before the stylesheet, so a reader in dark
|
|
693
|
+
mode gets a dark canvas rather than a white flash while the stylesheet loads.
|
|
694
|
+
`<meta name="theme-color">` is printed twice, once with
|
|
695
|
+
`media="(prefers-color-scheme: light)"` and once for dark.
|
|
696
|
+
|
|
659
697
|
**The card.** `og:title` is the page's title, or the site's on the front page;
|
|
660
698
|
`og:site_name` is always the site's. `og:type` is `article` on a rendered post
|
|
661
699
|
or page and `website` everywhere else, a listing carrying a page's front matter
|
|
662
|
-
included. `og:url` is the canonical URL.
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
700
|
+
included. `og:url` is the canonical URL. An article also carries
|
|
701
|
+
`article:published_time`, `article:modified_time` (the `updated` date, else the
|
|
702
|
+
publish date), `article:author` (the author's profile URL here, else their
|
|
703
|
+
name) and one `article:tag` per tag.
|
|
704
|
+
|
|
705
|
+
**The picture** is the `image` in the entry's front matter, else `site.avatar`,
|
|
706
|
+
on the context as `shareImage`. A site with neither prints no `og:image` and no
|
|
707
|
+
`twitter:image` rather than an empty one. The picture always carries
|
|
708
|
+
`og:image:alt` and `twitter:image:alt`. For the entry's own picture, the alt
|
|
709
|
+
text is its `imageAlt` front matter, else what the media library says about the
|
|
710
|
+
upload, else the entry's title. For the avatar, it is the media library's text,
|
|
711
|
+
else the site's author. `og:image:width` and `og:image:height` are printed when
|
|
712
|
+
the image's variants have been derived, because the size is read from their
|
|
713
|
+
sidecar rather than from the file. `twitter:card` is `summary_large_image` for a
|
|
714
|
+
picture at least 1200 pixels wide and wider than it is tall. Everything else,
|
|
715
|
+
the avatar included, is `summary`, the small picture beside the words.
|
|
716
|
+
|
|
717
|
+
**The icons** come from the site's `icon` setting in `site.json`, else
|
|
718
|
+
`site.avatar`, through the derived images (decision-10). `icon` exists for a
|
|
719
|
+
site whose avatar is a face and whose mark is a logo. The head links `icon` at
|
|
720
|
+
32 and 16 pixels and `apple-touch-icon` at 180, each a square PNG cropped from
|
|
721
|
+
the middle of the picture and encoded the first time a browser asks for it. An
|
|
722
|
+
SVG icon is linked first as itself, with `type="image/svg+xml"` and no
|
|
723
|
+
`sizes`, and the PNGs are rasterised from it. They are on the context as
|
|
724
|
+
`icons`, a list of `{ rel, sizes, type, href }`, which is empty, and the links
|
|
725
|
+
are not printed at all, when the site has neither setting, when it names a
|
|
726
|
+
file no icon can be made of, or when image optimization is off.
|
|
727
|
+
|
|
728
|
+
**The favicon and the manifest** are routes, not templates. `/favicon.ico`
|
|
729
|
+
holds 16, 32 and 48 pixel frames drawn from the same picture, because browsers
|
|
730
|
+
and crawlers ask the root for it whatever the head links; it answers 404 on a
|
|
731
|
+
site with no icon. `/manifest.webmanifest` gives the site's title as `name` and
|
|
732
|
+
`short_name`, `start_url` `/`, `display` `minimal-ui`, the theme's light
|
|
733
|
+
`themeColor` as `theme_color` and `background_color`, and icons at 192 and 512
|
|
734
|
+
pixels plus a maskable 512 whose picture sits inside the middle 80%, padded
|
|
735
|
+
with its own dominant colour. The head links it on every page.
|
|
678
736
|
|
|
679
737
|
**The structured data** is `partials/jsonld.njk`, one `<script
|
|
680
738
|
type="application/ld+json">` holding one `@graph` per page, and it is the only
|
|
@@ -684,7 +742,8 @@ IndieWeb. The graph holds:
|
|
|
684
742
|
|
|
685
743
|
- `WebSite`, always, with the site's title, tagline and URL, and a `publisher`
|
|
686
744
|
pointing at the Person, and a `potentialAction` that is a `SearchAction` on
|
|
687
|
-
`/search/?q={search_term_string}`.
|
|
745
|
+
`/search/?q={search_term_string}`. On the homepage of a solo author blog it
|
|
746
|
+
also has an `about` pointing at the site author's Person.
|
|
688
747
|
- `Person`, from `siteAuthor`: their name, archive URL, avatar, bio, job title
|
|
689
748
|
and location, and a `sameAs` of their profile links and their actor id, which
|
|
690
749
|
is what asserts that the schema.org Person and the fediverse actor are one
|
|
@@ -695,6 +754,9 @@ IndieWeb. The graph holds:
|
|
|
695
754
|
- `BlogPosting` on a post and `Article` on a page, with the headline, URL,
|
|
696
755
|
`mainEntityOfPage`, `datePublished`, `dateModified`, description, image,
|
|
697
756
|
`author` and `publisher`.
|
|
757
|
+
- `BreadcrumbList` wherever the page prints a breadcrumb (see
|
|
758
|
+
[The page shell](#the-page-shell)): one `ListItem` per crumb with its
|
|
759
|
+
`position`, `name` and absolute URL as `item`.
|
|
698
760
|
|
|
699
761
|
A site that wants a different graph — more types, an `Organization` publisher,
|
|
700
762
|
nothing at all — writes its own `partials/jsonld.njk` and that file replaces
|
|
@@ -955,7 +1017,11 @@ Every template gets:
|
|
|
955
1017
|
| `site` | `content/_data/site.json`, if the site has one, over the defaults `title` and `url`. Any key in the file is readable, so `site.tagline`, `site.author` and anything else a site adds are all available. |
|
|
956
1018
|
| `menus` | Every menu the site stores, by name, marked for this page: `menus.primary`, `menus.footer`, and any other name. See [Navigation](#navigation). |
|
|
957
1019
|
| `siteAuthor` | Who the page is by, as a profile. **Absent** when nobody matches. See [Bylines and author archives](#bylines-and-author-archives). |
|
|
958
|
-
| `
|
|
1020
|
+
| `soloAuthor` | The site author's profile, on a site whose Solo author blog setting is on. **Absent** when it is off or the author setting names nobody. See [The bio](#the-bio). |
|
|
1021
|
+
| `icons` | The site's icons, as `{ rel, sizes, type, href }`. Empty until the site has an icon or an avatar to derive them from. See [The head](#the-head). |
|
|
1022
|
+
| `theme` | The colours the theme declares, as `{ colorScheme, themeColor: { light, dark } }`, each absent when no theme declares it. See [The manifest](#the-manifest). |
|
|
1023
|
+
| `shareImage` | The picture a shared link shows, as `{ url, alt, size: { width, height }, card }`. `size` is absent when it is not known. **Absent** when there is no picture. See [The head](#the-head). |
|
|
1024
|
+
| `llmsTxt` | The path of `/llms.txt`, while the site serves it. **Absent** when the site has turned it off. The default theme links it from the front page only. |
|
|
959
1025
|
|
|
960
1026
|
A document — one post, one page, or one entry of a listing — adds:
|
|
961
1027
|
|
|
@@ -975,6 +1041,7 @@ A document — one post, one page, or one entry of a listing — adds:
|
|
|
975
1041
|
| `page.inputPath` | The source file, relative to the content directory. |
|
|
976
1042
|
| `type` | `post` or `page`. |
|
|
977
1043
|
| `permalink`, `slug`, `draft`, `description` | Straight from the front matter. |
|
|
1044
|
+
| `lang` | The `lang` front matter as a canonical tag, such as `fr-CA`. Absent when it names none or no tag. |
|
|
978
1045
|
| `author` | Who wrote it, as a profile rather than a string. See [Bylines and author archives](#bylines-and-author-archives). |
|
|
979
1046
|
| `activityStreams` | The post's ActivityPub object id, absolute. Only on a rendered published post. |
|
|
980
1047
|
| `previous` | The published post before this one by date, as `{ title, url }`. Absent on the oldest post. |
|
|
@@ -1005,7 +1072,10 @@ archive — adds:
|
|
|
1005
1072
|
How many posts a listing page holds comes from `postsPerPage` in
|
|
1006
1073
|
`content/_data/site.json`, and defaults to 10. How many entries a feed holds
|
|
1007
1074
|
comes from `feedSize` in the same file, and defaults to 20. The `<html lang>`
|
|
1008
|
-
comes from `language`, and defaults to `en`.
|
|
1075
|
+
comes from `language`, and defaults to `en`. A document whose `lang` names
|
|
1076
|
+
another language carries it on its own `<article>`, in an entry, a listing and
|
|
1077
|
+
search results alike, through `partials/lang.njk`, and the dates inside that
|
|
1078
|
+
article are written in it (see the `date` filter). The rssCloud and WebSub server the
|
|
1009
1079
|
feeds advertise comes from `notifyServer`, and is empty for none; the theme
|
|
1010
1080
|
writes nothing for it, because a cloud is advertised in the feed rather than on
|
|
1011
1081
|
the page.
|
|
@@ -1253,6 +1323,15 @@ site that has turned them off advertises nothing. The CMS also sends the same
|
|
|
1253
1323
|
endpoint as a `Link` header on every representation of a document, so a sender
|
|
1254
1324
|
that does not parse HTML still finds it.
|
|
1255
1325
|
|
|
1326
|
+
On the front page it also writes the site's index for language models:
|
|
1327
|
+
|
|
1328
|
+
```html
|
|
1329
|
+
<link rel="describedby" type="text/markdown" href="/llms.txt" />
|
|
1330
|
+
```
|
|
1331
|
+
|
|
1332
|
+
It comes from `llmsTxt` on the context, which is absent once the site turns the
|
|
1333
|
+
file off. The CMS sends the same link as a `Link` header on the front page.
|
|
1334
|
+
|
|
1256
1335
|
`layouts/tag.njk` and `layouts/category.njk` override that block, call `super()`
|
|
1257
1336
|
and add the archive's own three feeds:
|
|
1258
1337
|
|
|
@@ -1599,18 +1678,29 @@ the import above carries `with context`: a macro imported without it cannot see
|
|
|
1599
1678
|
|
|
1600
1679
|
## Filters
|
|
1601
1680
|
|
|
1602
|
-
| Filter
|
|
1603
|
-
|
|
|
1604
|
-
| `date(format, zone)` | Formats a `Date` or a date string. `readable` (the default) gives `
|
|
1605
|
-
| `
|
|
1606
|
-
| `
|
|
1607
|
-
| `
|
|
1681
|
+
| Filter | What it does |
|
|
1682
|
+
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1683
|
+
| `date(format, zone, locale)` | Formats a `Date` or a date string. `long` gives `2 September 2026` on an `en` site and `2 septembre 2026` on an `fr` one; `full`, `medium` and `short` are Intl's other date styles, and `readable` (the default) is `long`. `month` gives `September 2026`, `year` gives `2026`, `html` gives `2026-09-02` for a `<time datetime>`, and `iso` gives the full ISO 8601 instant. Every format but `html` and `iso` is written in the site's locale: the `locale` setting, or the `language` when that is empty. Bare `en` writes the day first, as `en-GB` does; `en-US` gives `September 2, 2026`. A date in a file is a UTC instant; every format but `iso` is rendered in the site's `timezone` setting, and `iso` stays the instant. Pass `zone` — an IANA name — to override the setting for one call. Pass `locale` — a BCP 47 tag — to write the words in another language for one call; it comes after `zone`, so pass `none` for the zone to keep the site's: `{{ date \| date("readable", none, lang) }}`. An empty locale, or one that is no tag, writes in the site's. A value that is not a date renders as the empty string. |
|
|
1684
|
+
| `plural(forms, locale)` | Picks the form for a count by its plural category in the site's locale, through `Intl.PluralRules`: `{{ n \| plural({ one: "# reply", other: "# replies" }) }}`. The keys are the CLDR categories (`zero`, `one`, `two`, `few`, `many`, `other`), a category the forms leave out falls back to `other`, and `#` is the count in the locale's digits. Pass `locale` when the strings are in a language of their own: the default theme's words are English, so it passes `"en"`. |
|
|
1685
|
+
| `url` | Prefixes a root-relative path with the base URL's path, so a site served from a subdirectory links correctly. Eleventy's filter of the same name. |
|
|
1686
|
+
| `absoluteUrl` | The same path as a fully qualified URL against the site's `baseUrl`. |
|
|
1687
|
+
| `asset` | The URL of a file in the theme's `static/` directory, with the base path in front and a hash of the file's bytes on the end: `{{ "style.css" \| asset }}` gives `/theme/style.css?v=3f2a9c01b7d4`. The file is found the way `/theme/` finds it, the chosen theme first. A hashed URL is served with `Cache-Control: public, max-age=31536000, immutable`, and editing the file changes the hash on the next render. A file no theme has gets its plain `/theme/` URL. |
|
|
1608
1688
|
|
|
1609
1689
|
`date` reads one word rather than parsing it: `{{ "now" | date("year") }}` is
|
|
1610
1690
|
the year at the moment the page is rendered, in the site's own timezone. It is
|
|
1611
1691
|
what the footer's copyright line is written with, and it is the one date a page
|
|
1612
1692
|
has that no file carries.
|
|
1613
1693
|
|
|
1694
|
+
The default theme passes the document's `lang` as that locale for every date
|
|
1695
|
+
inside its `<article>`: the Published and Updated lines, the hidden heading of
|
|
1696
|
+
a note, the kicker in a listing or a search result (`kicker.line(…,
|
|
1697
|
+
lang=post.lang)`), and the date of the post a reply answers. So a post that
|
|
1698
|
+
says `lang: fr` on an `en` site reads `Published 2 septembre 2026`, while the
|
|
1699
|
+
navigation, the conversation under it, the archive's month headings and the
|
|
1700
|
+
footer stay in the site's locale. A theme that wants the same passes `lang`
|
|
1701
|
+
on an entry and `post.lang` in a listing; one that passes nothing writes every
|
|
1702
|
+
date in the site's locale, as before.
|
|
1703
|
+
|
|
1614
1704
|
Nunjucks' own filters — `default`, `join`, `urlencode`, `safe` and the rest —
|
|
1615
1705
|
are all available. Autoescaping is on, so rendered Markdown is the one thing
|
|
1616
1706
|
that has to be passed through `safe`.
|