@agent-cms/agentcms 0.0.0-stage → 0.1.1
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/LICENSE +143 -0
- package/README.md +1119 -2
- package/changelog.json +31 -0
- package/dist/admin/admin-files.json +48 -0
- package/dist/admin/assets/CodeEditor-Wx1WlF3h.js +24 -0
- package/dist/admin/assets/flexweg-logo-CdtuqAFA.png +0 -0
- package/dist/admin/assets/index-DFVZw8E0.js +5460 -0
- package/dist/admin/assets/index-DMcGogR2.css +1 -0
- package/dist/admin/assets/sql-wasm-Bfkbn6Oa.js +2 -0
- package/dist/admin/assets/sql-wasm-C1U8OeUW.wasm +0 -0
- package/dist/admin/assets/sql-wasm-V5jTDcrT.js +1 -0
- package/dist/admin/config.js +11 -0
- package/dist/admin/external.default.json +72 -0
- package/dist/admin/index.html +116 -0
- package/dist/admin/plugins/core-seo/bundle.js +55 -0
- package/dist/admin/plugins/core-seo/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-archives/bundle.js +1414 -0
- package/dist/admin/plugins/flexweg-archives/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-multilang/bundle.js +1187 -0
- package/dist/admin/plugins/flexweg-multilang/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-rss/bundle.js +1354 -0
- package/dist/admin/plugins/flexweg-rss/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-search/bundle.js +1243 -0
- package/dist/admin/plugins/flexweg-search/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-sitemaps/bundle.js +1293 -0
- package/dist/admin/plugins/flexweg-sitemaps/manifest.json +7 -0
- package/dist/admin/runtime/cms-runtime.js +164 -0
- package/dist/admin/runtime/react-dom-client.js +13 -0
- package/dist/admin/runtime/react-dom.js +16 -0
- package/dist/admin/runtime/react-i18next.js +21 -0
- package/dist/admin/runtime/react-jsx-runtime.js +17 -0
- package/dist/admin/runtime/react.js +55 -0
- package/dist/admin/themes/corporate/bundle.js +14465 -0
- package/dist/admin/themes/corporate/manifest.json +7 -0
- package/dist/admin/themes/corporate/theme.css +2 -0
- package/dist/admin/themes/magazine/bundle.js +10229 -0
- package/dist/admin/themes/magazine/manifest.json +7 -0
- package/dist/admin/themes/magazine/theme.css +2 -0
- package/dist/admin/themes/marketplace-core/bundle.js +11213 -0
- package/dist/admin/themes/marketplace-core/manifest.json +7 -0
- package/dist/admin/themes/marketplace-core/theme.css +1613 -0
- package/dist/admin/themes/portfolio/bundle.js +9195 -0
- package/dist/admin/themes/portfolio/manifest.json +7 -0
- package/dist/admin/themes/portfolio/theme.css +2 -0
- package/dist/admin/themes/storefront/bundle.js +13172 -0
- package/dist/admin/themes/storefront/manifest.json +7 -0
- package/dist/admin/themes/storefront/theme.css +2 -0
- package/dist/agent/agentcms.mjs +1711 -0
- package/dist/agent/chunks/hosting-BftlDdsL.mjs +117 -0
- package/dist/agent/chunks/index-BG05qslv.mjs +3608 -0
- package/dist/agent/chunks/install-DnmgOT3F.mjs +577 -0
- package/dist/agent/chunks/plan-BrM8ztEp.mjs +245 -0
- package/dist/agent/chunks/registry-C9TSnZ77.mjs +53517 -0
- package/dist/agent/chunks/siteAdd-BcXhN9fk.mjs +118 -0
- package/dist/agent/chunks/sql-wasm-GjJDiefO.mjs +10 -0
- package/dist/agent/chunks/sqljs-DjSCStJ0.mjs +20 -0
- package/dist/agent/vendor/sql-wasm.cjs +188 -0
- package/dist/theme-assets/corporate-menu.js +266 -0
- package/dist/theme-assets/corporate-posts.js +571 -0
- package/dist/theme-assets/corporate.css +2 -0
- package/dist/theme-assets/default-menu.js +266 -0
- package/dist/theme-assets/default-posts.js +378 -0
- package/dist/theme-assets/default.css +1 -0
- package/dist/theme-assets/magazine-menu.js +227 -0
- package/dist/theme-assets/magazine-posts.js +361 -0
- package/dist/theme-assets/magazine.css +2 -0
- package/dist/theme-assets/portfolio-filters.js +104 -0
- package/dist/theme-assets/portfolio-menu.js +240 -0
- package/dist/theme-assets/portfolio-posts.js +358 -0
- package/dist/theme-assets/portfolio.css +2 -0
- package/dist/theme-assets/storefront-catalog.js +504 -0
- package/dist/theme-assets/storefront-menu.js +239 -0
- package/dist/theme-assets/storefront-posts.js +404 -0
- package/dist/theme-assets/storefront.css +2 -0
- package/dist/version.json +9 -0
- package/package.json +101 -4
- package/plugin/.claude-plugin/plugin.json +16 -0
- package/plugin/skills/agentcms-install/SKILL.md +110 -0
- package/plugin/skills/agentcms-install/references/cloudflare.md +15 -0
- package/plugin/skills/agentcms-install/references/flexweg.md +11 -0
- package/plugin/skills/agentcms-install/references/github.md +67 -0
- package/plugin/skills/agentcms-install/references/gitlab.md +15 -0
- package/plugin/skills/agentcms-install/references/s3.md +81 -0
- package/plugin/skills/agentcms-manage/SKILL.md +92 -0
|
@@ -0,0 +1,1187 @@
|
|
|
1
|
+
import { canonicalUrl as _, getActiveTheme as G, renderMarkdown as ve, applyFilters as Se, markdownToPlainText as se, renderPageToHtml as ae, renderHome as Te, updatePost as re, pathToPublicUrl as B, deleteFile as X, publishPostsJson as xe, publishAuthorsJson as Pe, useCmsData as ie, toast as J, isValidSlug as oe, fetchAllPosts as K } from "@flexweg/cms-runtime";
|
|
2
|
+
import { jsxs as v, jsx as m } from "react/jsx-runtime";
|
|
3
|
+
import { useState as Y } from "react";
|
|
4
|
+
import { useTranslation as le } from "react-i18next";
|
|
5
|
+
const $e = { title: "Multi-language", intro: "Configure additional languages. Each enabled language gets its own URL prefix and per-post translations.", save: "Save settings", saving: "Saving…", saved: "Saved.", primaryLanguage: { title: "Primary language", help: "Pages in this language live at the root URL (no language prefix). All other languages render under /<lang>/.", siteHint: 'Site language is currently "{{lang}}".' }, enabledLanguages: { title: "Additional languages", help: "Click a language to toggle it. Enabled languages appear in the editor's Translations tab + on the public site under /<lang>/." }, homePages: { title: "Home page per language", help: "Optional: pick a static page (in the corresponding language) to render at /<lang>/. Leave empty for a basic latest-posts list.", none: "— Latest posts —" }, switcher: { title: "Language switcher", help: "Show a language switcher on the public site. Themes must include a [data-cms-langswitch] container in their Header / Footer for the switcher to appear (built-in themes already do).", header: "Show switcher in the site header", footer: "Show switcher in the site footer" } }, Me = { label: "Translations", noLanguages: "No additional languages are configured for this site.", configureLanguages: "Configure languages", editPrimaryInMain: "Edit the primary language in the main editor (title, slug, content above).", save: "Save translations", saving: "Saving…", saved: "Translations saved.", duplicate: "Duplicate from primary", invalidSlug: "Invalid slug for {{lang}}.", fields: { title: "Title", slug: "Slug", slugHelp: "Lower-case ASCII + dashes only.", excerpt: "Excerpt", content: "Content (Markdown)", contentHelp: "Plain Markdown. Theme blocks (Hero, embeds, etc.) embedded in the primary language do NOT replicate automatically — paste your translated body here.", seo: "SEO", seoTitle: "SEO title", seoDescription: "Meta description" } }, ke = { title: "Translations", name: "Name", slug: "Slug", invalidSlug: "Invalid slug", seoTitle: "SEO meta title", seoDescription: "SEO meta description", noLanguages: "Enable secondary languages in the Multi-language plugin settings to translate this term." }, Ce = {
|
|
6
|
+
settings: $e,
|
|
7
|
+
tab: Me,
|
|
8
|
+
termSection: ke
|
|
9
|
+
}, Ne = { title: "Multilingue", intro: "Configurez les langues supplémentaires. Chaque langue activée obtient son préfixe d'URL et des traductions par contenu.", save: "Sauvegarder", saving: "Sauvegarde…", saved: "Sauvegardé.", primaryLanguage: { title: "Langue principale", help: "Les pages dans cette langue se trouvent à la racine du site (sans préfixe). Les autres langues sont sous /<lang>/.", siteHint: "La langue du site est actuellement « {{lang}} »." }, enabledLanguages: { title: "Langues supplémentaires", help: "Cliquez une langue pour l'activer. Les langues activées apparaissent dans l'onglet Traductions de l'éditeur et sur le site public sous /<lang>/." }, homePages: { title: "Page d'accueil par langue", help: "Optionnel : choisissez une page statique (dans la langue correspondante) pour servir d'accueil à /<lang>/. Sinon, une liste des derniers articles est rendue.", none: "— Derniers articles —" }, switcher: { title: "Sélecteur de langue", help: "Affiche un sélecteur de langue sur le site public. Les thèmes doivent intégrer un conteneur [data-cms-langswitch] dans leur Header / Footer pour que le sélecteur apparaisse (les thèmes intégrés le font déjà).", header: "Afficher le sélecteur dans l'en-tête du site", footer: "Afficher le sélecteur dans le pied de page du site" } }, Ie = { label: "Traductions", noLanguages: "Aucune langue supplémentaire n'est configurée.", configureLanguages: "Configurer les langues", editPrimaryInMain: "Modifiez la langue principale dans l'éditeur (titre, slug, contenu ci-dessus).", save: "Sauvegarder les traductions", saving: "Sauvegarde…", saved: "Traductions sauvegardées.", duplicate: "Dupliquer depuis la langue principale", invalidSlug: "Slug invalide pour {{lang}}.", fields: { title: "Titre", slug: "Slug", slugHelp: "Caractères ASCII minuscules + tirets uniquement.", excerpt: "Extrait", content: "Contenu (Markdown)", contentHelp: "Markdown simple. Les blocs de thème (Hero, embeds, etc.) intégrés dans la langue principale ne sont PAS répliqués automatiquement — collez votre contenu traduit ici.", seo: "SEO", seoTitle: "Titre SEO", seoDescription: "Méta description" } }, Ae = { title: "Traductions", name: "Nom", slug: "Slug", invalidSlug: "Slug invalide", seoTitle: "Titre meta SEO", seoDescription: "Description meta SEO", noLanguages: "Activez des langues secondaires dans les réglages du plugin Multilingue pour traduire ce terme." }, Ee = {
|
|
10
|
+
settings: Ne,
|
|
11
|
+
tab: Ie,
|
|
12
|
+
termSection: Ae
|
|
13
|
+
}, H = {
|
|
14
|
+
primaryLanguage: "en",
|
|
15
|
+
enabledLanguages: [],
|
|
16
|
+
homePages: {},
|
|
17
|
+
menuTranslations: {},
|
|
18
|
+
showHeaderSwitcher: !0,
|
|
19
|
+
showFooterSwitcher: !1
|
|
20
|
+
}, Ue = "flexweg-multilang";
|
|
21
|
+
function b(n) {
|
|
22
|
+
var t;
|
|
23
|
+
const e = (t = n.pluginConfigs) == null ? void 0 : t[Ue];
|
|
24
|
+
return {
|
|
25
|
+
...H,
|
|
26
|
+
// Default the primary language to the site's BCP-47 language tag
|
|
27
|
+
// so a fresh install picks the right value without manual setup.
|
|
28
|
+
primaryLanguage: (e == null ? void 0 : e.primaryLanguage) || (n.language || "en").split("-")[0],
|
|
29
|
+
enabledLanguages: (e == null ? void 0 : e.enabledLanguages) ?? [],
|
|
30
|
+
homePages: (e == null ? void 0 : e.homePages) ?? {},
|
|
31
|
+
menuTranslations: (e == null ? void 0 : e.menuTranslations) ?? {},
|
|
32
|
+
showHeaderSwitcher: (e == null ? void 0 : e.showHeaderSwitcher) ?? H.showHeaderSwitcher,
|
|
33
|
+
showFooterSwitcher: (e == null ? void 0 : e.showFooterSwitcher) ?? H.showFooterSwitcher
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function y(n, e) {
|
|
37
|
+
return n.primaryLanguage === e;
|
|
38
|
+
}
|
|
39
|
+
function F(n) {
|
|
40
|
+
const { post: e, trans: t, primaryTermTrans: s, primaryTermSlug: a, language: r, config: o } = n, i = y(o, r) ? "" : `${r}/`;
|
|
41
|
+
if (e.type === "page")
|
|
42
|
+
return `${i}${t.slug}.html`;
|
|
43
|
+
const l = (s == null ? void 0 : s.slug) ?? a;
|
|
44
|
+
return l ? `${i}${l}/${t.slug}.html` : `${i}${t.slug}.html`;
|
|
45
|
+
}
|
|
46
|
+
function V(n, e, t, s) {
|
|
47
|
+
if (n.type !== "category")
|
|
48
|
+
throw new Error(`buildLocalizedTermUrl: term type "${n.type}" is not supported (categories only).`);
|
|
49
|
+
return `${y(s, t) ? "" : `${t}/`}${e.slug}/index.html`;
|
|
50
|
+
}
|
|
51
|
+
function z(n, e) {
|
|
52
|
+
return y(e, n) ? "index.html" : `${n}/index.html`;
|
|
53
|
+
}
|
|
54
|
+
function C(n, e) {
|
|
55
|
+
const t = n.translations, s = t == null ? void 0 : t[e];
|
|
56
|
+
return !s || !s.slug || !s.title ? null : s;
|
|
57
|
+
}
|
|
58
|
+
function $(n, e) {
|
|
59
|
+
const t = n.translations, s = t == null ? void 0 : t[e];
|
|
60
|
+
return !s || !s.slug || !s.name ? null : s;
|
|
61
|
+
}
|
|
62
|
+
function O(n) {
|
|
63
|
+
return {
|
|
64
|
+
slug: n.slug,
|
|
65
|
+
title: n.title,
|
|
66
|
+
contentMarkdown: n.contentMarkdown,
|
|
67
|
+
excerpt: n.excerpt,
|
|
68
|
+
seo: n.seo
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function R(n) {
|
|
72
|
+
return {
|
|
73
|
+
slug: n.slug,
|
|
74
|
+
name: n.name,
|
|
75
|
+
description: n.description,
|
|
76
|
+
seo: n.seo
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function Q(n) {
|
|
80
|
+
const e = n.replace("-", "_");
|
|
81
|
+
return e.includes("_") ? e : {
|
|
82
|
+
en: "en_US",
|
|
83
|
+
fr: "fr_FR",
|
|
84
|
+
es: "es_ES",
|
|
85
|
+
de: "de_DE",
|
|
86
|
+
nl: "nl_NL",
|
|
87
|
+
pt: "pt_PT",
|
|
88
|
+
ko: "ko_KR",
|
|
89
|
+
it: "it_IT",
|
|
90
|
+
ja: "ja_JP"
|
|
91
|
+
}[e] ?? `${e}_${e.toUpperCase()}`;
|
|
92
|
+
}
|
|
93
|
+
function k(n) {
|
|
94
|
+
return n.replace(/[&<>"']/g, (e) => {
|
|
95
|
+
switch (e) {
|
|
96
|
+
case "&":
|
|
97
|
+
return "&";
|
|
98
|
+
case "<":
|
|
99
|
+
return "<";
|
|
100
|
+
case ">":
|
|
101
|
+
return ">";
|
|
102
|
+
case '"':
|
|
103
|
+
return """;
|
|
104
|
+
default:
|
|
105
|
+
return "'";
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function j(n, e, t) {
|
|
110
|
+
const s = e.replace(/\/+$/, "");
|
|
111
|
+
if (!s) return "";
|
|
112
|
+
const a = [];
|
|
113
|
+
for (const o of n.alternates) {
|
|
114
|
+
const i = _(s, o.path);
|
|
115
|
+
a.push(
|
|
116
|
+
`<link rel="alternate" hreflang="${k(o.language)}" href="${k(i)}" />`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
const r = n.alternates.find((o) => o.language === t.primaryLanguage);
|
|
120
|
+
if (r) {
|
|
121
|
+
const o = _(s, r.path);
|
|
122
|
+
a.push(`<link rel="alternate" hreflang="x-default" href="${k(o)}" />`);
|
|
123
|
+
}
|
|
124
|
+
a.push(
|
|
125
|
+
`<meta property="og:locale" content="${k(Q(n.current.language))}" />`
|
|
126
|
+
);
|
|
127
|
+
for (const o of n.alternates)
|
|
128
|
+
o.language !== n.current.language && a.push(
|
|
129
|
+
`<meta property="og:locale:alternate" content="${k(Q(o.language))}" />`
|
|
130
|
+
);
|
|
131
|
+
return a.join(`
|
|
132
|
+
`);
|
|
133
|
+
}
|
|
134
|
+
function ce(n, e, t) {
|
|
135
|
+
const s = e.replace(/\/+$/, "");
|
|
136
|
+
if (!s || n.alternates.length === 0) return "";
|
|
137
|
+
const a = [];
|
|
138
|
+
for (const o of n.alternates) {
|
|
139
|
+
const i = _(s, o.path);
|
|
140
|
+
a.push(
|
|
141
|
+
` <xhtml:link rel="alternate" hreflang="${k(o.language)}" href="${k(i)}"/>`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
const r = n.alternates.find((o) => o.language === t.primaryLanguage);
|
|
145
|
+
if (r) {
|
|
146
|
+
const o = _(s, r.path);
|
|
147
|
+
a.push(
|
|
148
|
+
` <xhtml:link rel="alternate" hreflang="x-default" href="${k(o)}"/>`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return a.join(`
|
|
152
|
+
`);
|
|
153
|
+
}
|
|
154
|
+
function q(n, e, t) {
|
|
155
|
+
const s = [];
|
|
156
|
+
for (const a of [t.primaryLanguage, ...t.enabledLanguages]) {
|
|
157
|
+
if (s.some((c) => c.language === a)) continue;
|
|
158
|
+
const r = a === t.primaryLanguage ? O(n) : C(n, a);
|
|
159
|
+
if (!r) continue;
|
|
160
|
+
const o = n.primaryTermId ? e.find((c) => c.id === n.primaryTermId) : void 0, i = o ? a === t.primaryLanguage ? R(o) : $(o, a) ?? void 0 : void 0;
|
|
161
|
+
if (o && !i && !y(t, a)) continue;
|
|
162
|
+
const l = F({
|
|
163
|
+
post: n,
|
|
164
|
+
trans: r,
|
|
165
|
+
primaryTermTrans: i,
|
|
166
|
+
primaryTermSlug: o == null ? void 0 : o.slug,
|
|
167
|
+
language: a,
|
|
168
|
+
config: t
|
|
169
|
+
});
|
|
170
|
+
s.push({ language: a, path: l });
|
|
171
|
+
}
|
|
172
|
+
return s;
|
|
173
|
+
}
|
|
174
|
+
function ue(n, e) {
|
|
175
|
+
const t = [];
|
|
176
|
+
for (const s of [e.primaryLanguage, ...e.enabledLanguages]) {
|
|
177
|
+
if (t.some((r) => r.language === s)) continue;
|
|
178
|
+
const a = s === e.primaryLanguage ? R(n) : $(n, s);
|
|
179
|
+
a && n.type === "category" && t.push({ language: s, path: V(n, a, s, e) });
|
|
180
|
+
}
|
|
181
|
+
return t;
|
|
182
|
+
}
|
|
183
|
+
function ge(n) {
|
|
184
|
+
const e = [];
|
|
185
|
+
for (const t of [n.primaryLanguage, ...n.enabledLanguages])
|
|
186
|
+
e.some((s) => s.language === t) || e.push({ language: t, path: z(t, n) });
|
|
187
|
+
return e;
|
|
188
|
+
}
|
|
189
|
+
function W(n) {
|
|
190
|
+
return (n.baseUrl || "").replace(/\/+$/, "");
|
|
191
|
+
}
|
|
192
|
+
const U = /* @__PURE__ */ new Map();
|
|
193
|
+
function I(n, e, t, s, a) {
|
|
194
|
+
U.clear();
|
|
195
|
+
const r = W(s);
|
|
196
|
+
if (!r) return;
|
|
197
|
+
for (const i of [...n, ...e]) {
|
|
198
|
+
if (i.status !== "online") continue;
|
|
199
|
+
const l = q(i, t, a);
|
|
200
|
+
if (l.length !== 0)
|
|
201
|
+
for (const c of l) {
|
|
202
|
+
const g = j(
|
|
203
|
+
{ current: { path: c.path, language: c.language }, alternates: l },
|
|
204
|
+
r,
|
|
205
|
+
a
|
|
206
|
+
);
|
|
207
|
+
U.set(c.path, g);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
for (const i of t) {
|
|
211
|
+
if (i.type !== "category") continue;
|
|
212
|
+
const l = ue(i, a);
|
|
213
|
+
if (l.length !== 0)
|
|
214
|
+
for (const c of l) {
|
|
215
|
+
const g = j(
|
|
216
|
+
{ current: { path: c.path, language: c.language }, alternates: l },
|
|
217
|
+
r,
|
|
218
|
+
a
|
|
219
|
+
);
|
|
220
|
+
U.set(c.path, g);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
const o = ge(a);
|
|
224
|
+
for (const i of o) {
|
|
225
|
+
const l = j(
|
|
226
|
+
{ current: { path: i.path, language: i.language }, alternates: o },
|
|
227
|
+
r,
|
|
228
|
+
a
|
|
229
|
+
);
|
|
230
|
+
U.set(i.path, l);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function De(n) {
|
|
234
|
+
const e = n.replace(/^\/+/, "");
|
|
235
|
+
return U.get(e) ?? U.get(`/${e}`) ?? "";
|
|
236
|
+
}
|
|
237
|
+
const D = /* @__PURE__ */ new Map();
|
|
238
|
+
function A(n, e, t, s) {
|
|
239
|
+
D.clear();
|
|
240
|
+
for (const r of [...n, ...e]) {
|
|
241
|
+
if (r.status !== "online") continue;
|
|
242
|
+
const o = q(r, t, s);
|
|
243
|
+
if (o.length !== 0)
|
|
244
|
+
for (const i of o)
|
|
245
|
+
D.set(i.path, { language: i.language, alternates: o });
|
|
246
|
+
}
|
|
247
|
+
for (const r of t) {
|
|
248
|
+
if (r.type !== "category") continue;
|
|
249
|
+
const o = ue(r, s);
|
|
250
|
+
if (o.length !== 0)
|
|
251
|
+
for (const i of o)
|
|
252
|
+
D.set(i.path, { language: i.language, alternates: o });
|
|
253
|
+
}
|
|
254
|
+
const a = ge(s);
|
|
255
|
+
for (const r of a)
|
|
256
|
+
D.set(r.path, { language: r.language, alternates: a });
|
|
257
|
+
}
|
|
258
|
+
function Fe(n) {
|
|
259
|
+
const e = n.replace(/^\/+/, "");
|
|
260
|
+
return D.get(e) ?? D.get(`/${e}`) ?? null;
|
|
261
|
+
}
|
|
262
|
+
function de(n) {
|
|
263
|
+
var s;
|
|
264
|
+
const e = G(n.settings.activeThemeId);
|
|
265
|
+
if (!e.settings) return;
|
|
266
|
+
const t = (s = n.settings.themeConfigs) == null ? void 0 : s[e.id];
|
|
267
|
+
return {
|
|
268
|
+
...e.settings.defaultConfig,
|
|
269
|
+
...t ?? {}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function He(n, e, t) {
|
|
273
|
+
const s = y(t, e), a = s ? "" : `${e}/`, r = { ...n.settings, language: e }, o = n.terms.map((g) => {
|
|
274
|
+
if (g.type !== "category") return g;
|
|
275
|
+
const d = s ? R(g) : $(g, e);
|
|
276
|
+
return d ? {
|
|
277
|
+
...g,
|
|
278
|
+
name: d.name,
|
|
279
|
+
// Prefix with language code so buildPostUrl produces
|
|
280
|
+
// <lang>/<term-slug>/<post-slug>.html for posts and
|
|
281
|
+
// <lang>/<term-slug>/index.html for the archive itself.
|
|
282
|
+
slug: `${a}${d.slug}`,
|
|
283
|
+
description: d.description
|
|
284
|
+
} : g;
|
|
285
|
+
}), i = (g) => {
|
|
286
|
+
const d = s ? O(g) : C(g, e);
|
|
287
|
+
if (!d) return null;
|
|
288
|
+
const p = g.type !== "post" || !g.primaryTermId;
|
|
289
|
+
return {
|
|
290
|
+
...g,
|
|
291
|
+
title: d.title,
|
|
292
|
+
slug: p ? `${a}${d.slug}` : d.slug,
|
|
293
|
+
contentMarkdown: d.contentMarkdown,
|
|
294
|
+
excerpt: d.excerpt,
|
|
295
|
+
seo: d.seo
|
|
296
|
+
};
|
|
297
|
+
}, l = n.posts.map(i).filter((g) => g !== null), c = n.pages.map(i).filter((g) => g !== null);
|
|
298
|
+
return {
|
|
299
|
+
...n,
|
|
300
|
+
settings: r,
|
|
301
|
+
posts: l,
|
|
302
|
+
pages: c,
|
|
303
|
+
terms: o
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
async function _e(n) {
|
|
307
|
+
var i;
|
|
308
|
+
const { language: e, ctx: t, config: s } = n, a = (i = s.homePages) == null ? void 0 : i[e], r = a ? { ...t.settings, homeMode: "static-page", homePageId: a } : t.settings, o = He({ ...t, settings: r }, e, s);
|
|
309
|
+
return Te(o, {
|
|
310
|
+
homePath: z(e, s),
|
|
311
|
+
currentLocale: e
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
async function ze(n) {
|
|
315
|
+
var x, P, T, N, M;
|
|
316
|
+
const { post: e, trans: t, termTrans: s, language: a, ctx: r, config: o } = n, i = G(r.settings.activeThemeId), l = {
|
|
317
|
+
settings: { ...r.settings, language: a },
|
|
318
|
+
resolvedMenus: { header: [], footer: [] },
|
|
319
|
+
themeCssPath: `theme-assets/${r.settings.activeThemeId}.css`,
|
|
320
|
+
themeConfig: de(r),
|
|
321
|
+
homePath: y(o, a) ? "/index.html" : `/${a}/index.html`
|
|
322
|
+
};
|
|
323
|
+
let c = ve(t.contentMarkdown);
|
|
324
|
+
c = await Se("post.html.body", c, e);
|
|
325
|
+
const g = r.terms.filter((E) => e.termIds.includes(E.id) && E.type === "tag"), d = e.primaryTermId ? r.terms.find((E) => E.id === e.primaryTermId && E.type === "category") : void 0, p = r.authorLookup(e.authorId), u = e.heroMediaId ? r.media.get(e.heroMediaId) : void 0, f = ((x = t.seo) == null ? void 0 : x.description) ?? se(t.contentMarkdown, 160);
|
|
326
|
+
let h = d;
|
|
327
|
+
if (d && s) {
|
|
328
|
+
const Le = y(o, a) ? "" : `${a}/`;
|
|
329
|
+
h = {
|
|
330
|
+
...d,
|
|
331
|
+
name: s.name,
|
|
332
|
+
slug: `${Le}${s.slug}`,
|
|
333
|
+
description: s.description
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
const S = F({
|
|
337
|
+
post: e,
|
|
338
|
+
trans: t,
|
|
339
|
+
primaryTermTrans: s,
|
|
340
|
+
primaryTermSlug: d == null ? void 0 : d.slug,
|
|
341
|
+
language: a,
|
|
342
|
+
config: o
|
|
343
|
+
}), L = {
|
|
344
|
+
site: l,
|
|
345
|
+
post: {
|
|
346
|
+
...e,
|
|
347
|
+
title: t.title,
|
|
348
|
+
slug: t.slug,
|
|
349
|
+
contentMarkdown: t.contentMarkdown,
|
|
350
|
+
excerpt: t.excerpt,
|
|
351
|
+
seo: t.seo
|
|
352
|
+
},
|
|
353
|
+
bodyHtml: c,
|
|
354
|
+
author: p,
|
|
355
|
+
hero: u ? {
|
|
356
|
+
alt: u.alt,
|
|
357
|
+
caption: u.caption,
|
|
358
|
+
default: ((T = (P = u.formats) == null ? void 0 : P[u.defaultFormat ?? ""]) == null ? void 0 : T.url) ?? u.url ?? "",
|
|
359
|
+
formats: u.formats ?? {}
|
|
360
|
+
} : void 0,
|
|
361
|
+
primaryTerm: h,
|
|
362
|
+
tags: g
|
|
363
|
+
}, w = {
|
|
364
|
+
site: l,
|
|
365
|
+
pageTitle: ((N = t.seo) == null ? void 0 : N.title) ?? t.title,
|
|
366
|
+
pageDescription: f || void 0,
|
|
367
|
+
ogImage: (M = t.seo) == null ? void 0 : M.ogImage,
|
|
368
|
+
currentPath: S,
|
|
369
|
+
currentLocale: a
|
|
370
|
+
};
|
|
371
|
+
return ae({
|
|
372
|
+
base: i.templates.base,
|
|
373
|
+
baseProps: w,
|
|
374
|
+
template: i.templates.single,
|
|
375
|
+
templateProps: L
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
function Oe(n) {
|
|
379
|
+
var h, S, L;
|
|
380
|
+
const { term: e, termTrans: t, language: s, ctx: a, config: r } = n, o = G(a.settings.activeThemeId), i = {
|
|
381
|
+
settings: { ...a.settings, language: s },
|
|
382
|
+
resolvedMenus: { header: [], footer: [] },
|
|
383
|
+
themeCssPath: `theme-assets/${a.settings.activeThemeId}.css`,
|
|
384
|
+
themeConfig: de(a),
|
|
385
|
+
homePath: y(r, s) ? "/index.html" : `/${s}/index.html`
|
|
386
|
+
}, l = {
|
|
387
|
+
...e,
|
|
388
|
+
name: t.name,
|
|
389
|
+
slug: t.slug,
|
|
390
|
+
description: t.description
|
|
391
|
+
}, c = y(r, s), g = c ? "" : `${s}/`, d = a.posts.filter((w) => w.status === "online" && w.primaryTermId === e.id).filter((w) => c ? !0 : C(w, s) !== null).map((w) => {
|
|
392
|
+
var N, M;
|
|
393
|
+
const x = c ? O(w) : C(w, s), P = F({
|
|
394
|
+
post: w,
|
|
395
|
+
trans: x,
|
|
396
|
+
primaryTermTrans: t,
|
|
397
|
+
primaryTermSlug: e.slug,
|
|
398
|
+
language: s,
|
|
399
|
+
config: r
|
|
400
|
+
}), T = w.heroMediaId ? a.media.get(w.heroMediaId) : void 0;
|
|
401
|
+
return {
|
|
402
|
+
...w,
|
|
403
|
+
title: x.title,
|
|
404
|
+
slug: x.slug,
|
|
405
|
+
excerpt: x.excerpt,
|
|
406
|
+
url: P,
|
|
407
|
+
hero: T ? {
|
|
408
|
+
alt: T.alt,
|
|
409
|
+
caption: T.caption,
|
|
410
|
+
default: ((M = (N = T.formats) == null ? void 0 : N[T.defaultFormat ?? ""]) == null ? void 0 : M.url) ?? T.url ?? "",
|
|
411
|
+
formats: T.formats ?? {}
|
|
412
|
+
} : void 0,
|
|
413
|
+
category: {
|
|
414
|
+
name: t.name,
|
|
415
|
+
url: `/${g}${t.slug}/index.html`
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
}), p = {
|
|
419
|
+
site: i,
|
|
420
|
+
term: l,
|
|
421
|
+
posts: d,
|
|
422
|
+
categoryRssUrl: void 0,
|
|
423
|
+
archivesLink: void 0,
|
|
424
|
+
allCategories: [],
|
|
425
|
+
popularTags: []
|
|
426
|
+
}, u = V(e, t, s, r), f = {
|
|
427
|
+
site: i,
|
|
428
|
+
pageTitle: ((h = t.seo) == null ? void 0 : h.title) || t.name,
|
|
429
|
+
pageDescription: ((S = t.seo) == null ? void 0 : S.description) || t.description,
|
|
430
|
+
ogImage: (L = t.seo) == null ? void 0 : L.ogImage,
|
|
431
|
+
currentPath: u,
|
|
432
|
+
currentLocale: s
|
|
433
|
+
};
|
|
434
|
+
return ae({
|
|
435
|
+
base: o.templates.base,
|
|
436
|
+
baseProps: f,
|
|
437
|
+
template: o.templates.category,
|
|
438
|
+
templateProps: p
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
async function Re(n, e, t) {
|
|
442
|
+
const s = b(t.settings);
|
|
443
|
+
if (s.enabledLanguages.length === 0) return n;
|
|
444
|
+
I(t.posts, t.pages, t.terms, t.settings, s), A(t.posts, t.pages, t.terms, s);
|
|
445
|
+
const a = [...n], r = {}, o = e.primaryTermId ? t.terms.find((i) => i.id === e.primaryTermId && i.type === "category") : void 0;
|
|
446
|
+
for (const i of s.enabledLanguages) {
|
|
447
|
+
if (y(s, i)) continue;
|
|
448
|
+
const l = C(e, i);
|
|
449
|
+
if (!l) continue;
|
|
450
|
+
const c = o ? $(o, i) : void 0;
|
|
451
|
+
if (o && !c) continue;
|
|
452
|
+
const g = F({
|
|
453
|
+
post: e,
|
|
454
|
+
trans: l,
|
|
455
|
+
primaryTermTrans: c ?? void 0,
|
|
456
|
+
primaryTermSlug: o == null ? void 0 : o.slug,
|
|
457
|
+
language: i,
|
|
458
|
+
config: s
|
|
459
|
+
}), d = await ze({
|
|
460
|
+
post: e,
|
|
461
|
+
trans: l,
|
|
462
|
+
termTrans: c ?? void 0,
|
|
463
|
+
language: i,
|
|
464
|
+
ctx: t,
|
|
465
|
+
config: s
|
|
466
|
+
});
|
|
467
|
+
a.push({ path: g, html: d }), r[i] = g;
|
|
468
|
+
}
|
|
469
|
+
try {
|
|
470
|
+
await re(e.id, { lastPublishedPathsByLocale: r });
|
|
471
|
+
} catch {
|
|
472
|
+
}
|
|
473
|
+
return a;
|
|
474
|
+
}
|
|
475
|
+
async function qe(n, e) {
|
|
476
|
+
const t = b(e.settings);
|
|
477
|
+
if (t.enabledLanguages.length === 0) return n;
|
|
478
|
+
I(e.posts, e.pages, e.terms, e.settings, t), A(e.posts, e.pages, e.terms, t);
|
|
479
|
+
const s = [...n];
|
|
480
|
+
for (const a of t.enabledLanguages) {
|
|
481
|
+
if (y(t, a)) continue;
|
|
482
|
+
const r = z(a, t), o = await _e({ language: a, ctx: e, config: t });
|
|
483
|
+
s.push({ path: r, html: o });
|
|
484
|
+
for (const i of e.terms) {
|
|
485
|
+
if (i.type !== "category") continue;
|
|
486
|
+
const l = $(i, a);
|
|
487
|
+
if (!l) continue;
|
|
488
|
+
const c = V(i, l, a, t), g = Oe({ term: i, termTrans: l, language: a, ctx: e, config: t });
|
|
489
|
+
s.push({ path: c, html: g });
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return s;
|
|
493
|
+
}
|
|
494
|
+
function je(n) {
|
|
495
|
+
return { ...n, "xmlns:xhtml": "http://www.w3.org/1999/xhtml" };
|
|
496
|
+
}
|
|
497
|
+
function Je(n, e) {
|
|
498
|
+
if (!e.entity) return n;
|
|
499
|
+
const t = We(), s = Xe();
|
|
500
|
+
if (!t || !s) return n;
|
|
501
|
+
const a = q(e.entity, s, t);
|
|
502
|
+
if (a.length === 0) return n;
|
|
503
|
+
const r = e.baseUrl.replace(/\/+$/, "");
|
|
504
|
+
return n + ce(
|
|
505
|
+
{ current: { path: e.path, language: t.primaryLanguage }, alternates: a },
|
|
506
|
+
r,
|
|
507
|
+
t
|
|
508
|
+
) + `
|
|
509
|
+
`;
|
|
510
|
+
}
|
|
511
|
+
function Ge(n, e) {
|
|
512
|
+
var r, o, i, l, c, g;
|
|
513
|
+
const t = b(e.settings);
|
|
514
|
+
if (t.enabledLanguages.length === 0) return n;
|
|
515
|
+
const s = W(e.settings);
|
|
516
|
+
if (!s) return n;
|
|
517
|
+
const a = [...n];
|
|
518
|
+
for (const d of [...e.posts, ...e.pages]) {
|
|
519
|
+
if (d.status !== "online") continue;
|
|
520
|
+
const p = ((o = (r = d.createdAt) == null ? void 0 : r.toMillis) == null ? void 0 : o.call(r)) ?? ((l = (i = d.publishedAt) == null ? void 0 : i.toMillis) == null ? void 0 : l.call(i)) ?? Date.now();
|
|
521
|
+
if (new Date(p).getUTCFullYear() !== e.year) continue;
|
|
522
|
+
const u = q(d, e.terms, t);
|
|
523
|
+
if (u.length !== 0)
|
|
524
|
+
for (const f of u)
|
|
525
|
+
y(t, f.language) || a.push({
|
|
526
|
+
path: f.path,
|
|
527
|
+
lastmodMs: ((g = (c = d.updatedAt) == null ? void 0 : c.toMillis) == null ? void 0 : g.call(c)) ?? p,
|
|
528
|
+
extraInnerXml: ce(
|
|
529
|
+
{ current: { path: f.path, language: f.language }, alternates: u },
|
|
530
|
+
s,
|
|
531
|
+
t
|
|
532
|
+
)
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
return a;
|
|
536
|
+
}
|
|
537
|
+
function Be(n, e) {
|
|
538
|
+
var r;
|
|
539
|
+
const t = (r = e.settings.pluginConfigs) == null ? void 0 : r["flexweg-sitemaps"];
|
|
540
|
+
if (!(t != null && t.newsEnabled)) return n;
|
|
541
|
+
const s = b(e.settings);
|
|
542
|
+
if (s.enabledLanguages.length === 0) return n;
|
|
543
|
+
const a = [...n];
|
|
544
|
+
for (const o of s.enabledLanguages)
|
|
545
|
+
y(s, o) || a.push({ path: `sitemaps/sitemap-news-${o}.xml` });
|
|
546
|
+
return a;
|
|
547
|
+
}
|
|
548
|
+
function Ve(n, e) {
|
|
549
|
+
var i, l, c, g, d, p, u, f;
|
|
550
|
+
const t = b(e.settings);
|
|
551
|
+
if (t.enabledLanguages.length === 0 || !W(e.settings)) return n;
|
|
552
|
+
const a = e.config.newsWindowDays || 2, r = Date.now() - a * 24 * 60 * 60 * 1e3, o = [...n];
|
|
553
|
+
for (const h of t.enabledLanguages) {
|
|
554
|
+
if (y(t, h)) continue;
|
|
555
|
+
const S = [];
|
|
556
|
+
for (const L of [...e.posts, ...e.pages]) {
|
|
557
|
+
if (L.status !== "online") continue;
|
|
558
|
+
const w = ((l = (i = L.updatedAt) == null ? void 0 : i.toMillis) == null ? void 0 : l.call(i)) ?? ((g = (c = L.publishedAt) == null ? void 0 : c.toMillis) == null ? void 0 : g.call(c)) ?? ((p = (d = L.createdAt) == null ? void 0 : d.toMillis) == null ? void 0 : p.call(d)) ?? Date.now();
|
|
559
|
+
if (w < r) continue;
|
|
560
|
+
const x = C(L, h);
|
|
561
|
+
if (!x) continue;
|
|
562
|
+
const P = L.primaryTermId ? e.terms.find((M) => M.id === L.primaryTermId && M.type === "category") : void 0, T = P ? $(P, h) ?? void 0 : void 0, N = F({
|
|
563
|
+
post: L,
|
|
564
|
+
trans: x,
|
|
565
|
+
primaryTermTrans: T,
|
|
566
|
+
primaryTermSlug: P == null ? void 0 : P.slug,
|
|
567
|
+
language: h,
|
|
568
|
+
config: t
|
|
569
|
+
});
|
|
570
|
+
S.push({
|
|
571
|
+
path: N,
|
|
572
|
+
title: x.title,
|
|
573
|
+
createdAtMs: ((f = (u = L.createdAt) == null ? void 0 : u.toMillis) == null ? void 0 : f.call(u)) ?? w,
|
|
574
|
+
updatedAtMs: w
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
o.push({
|
|
578
|
+
language: h,
|
|
579
|
+
path: `sitemaps/sitemap-news-${h}.xml`,
|
|
580
|
+
entities: S
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
return o;
|
|
584
|
+
}
|
|
585
|
+
let pe = null, me = null;
|
|
586
|
+
function fe(n) {
|
|
587
|
+
pe = n;
|
|
588
|
+
}
|
|
589
|
+
function he(n) {
|
|
590
|
+
me = n;
|
|
591
|
+
}
|
|
592
|
+
function We() {
|
|
593
|
+
return pe;
|
|
594
|
+
}
|
|
595
|
+
function Xe() {
|
|
596
|
+
return me;
|
|
597
|
+
}
|
|
598
|
+
const Ke = 20;
|
|
599
|
+
function Ye(n) {
|
|
600
|
+
return `${n}/rss.xml`;
|
|
601
|
+
}
|
|
602
|
+
function Qe(n) {
|
|
603
|
+
return `${n}/feed.xml`;
|
|
604
|
+
}
|
|
605
|
+
function Ze(n, e) {
|
|
606
|
+
return `${n}/${e}/${e}.xml`;
|
|
607
|
+
}
|
|
608
|
+
function et(n) {
|
|
609
|
+
const e = b(n.settings);
|
|
610
|
+
if (e.enabledLanguages.length === 0) return [];
|
|
611
|
+
const t = [];
|
|
612
|
+
for (const s of e.enabledLanguages) {
|
|
613
|
+
if (y(e, s)) continue;
|
|
614
|
+
const a = tt(n.posts, n.terms, s, e, n.baseUrl);
|
|
615
|
+
t.push({
|
|
616
|
+
language: s,
|
|
617
|
+
path: Ye(s),
|
|
618
|
+
channelTitle: `${n.settings.title || "Site"} — ${s.toUpperCase()}`,
|
|
619
|
+
channelLink: B(n.baseUrl, z(s, e)),
|
|
620
|
+
channelDescription: n.settings.description || n.settings.title || "",
|
|
621
|
+
items: a
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
return t;
|
|
625
|
+
}
|
|
626
|
+
async function ye(n) {
|
|
627
|
+
const e = b(n.settings);
|
|
628
|
+
for (const t of e.enabledLanguages)
|
|
629
|
+
if (!y(e, t)) {
|
|
630
|
+
try {
|
|
631
|
+
await X(Qe(t));
|
|
632
|
+
} catch {
|
|
633
|
+
}
|
|
634
|
+
for (const s of n.terms) {
|
|
635
|
+
if (s.type !== "category") continue;
|
|
636
|
+
const a = $(s, t);
|
|
637
|
+
if (a)
|
|
638
|
+
try {
|
|
639
|
+
await X(Ze(t, a.slug));
|
|
640
|
+
} catch {
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
function tt(n, e, t, s, a) {
|
|
646
|
+
return n.filter((r) => r.status === "online").map((r) => nt(r, e, t, s, a)).filter((r) => r !== null).sort((r, o) => o.pubDateMs - r.pubDateMs).slice(0, Ke);
|
|
647
|
+
}
|
|
648
|
+
function nt(n, e, t, s, a) {
|
|
649
|
+
var p, u, f, h, S, L;
|
|
650
|
+
const r = C(n, t);
|
|
651
|
+
if (!r) return null;
|
|
652
|
+
const o = n.primaryTermId ? e.find((w) => w.id === n.primaryTermId && w.type === "category") : void 0, i = o ? $(o, t) : void 0;
|
|
653
|
+
if (o && !i) return null;
|
|
654
|
+
const l = F({
|
|
655
|
+
post: n,
|
|
656
|
+
trans: r,
|
|
657
|
+
primaryTermTrans: i ?? void 0,
|
|
658
|
+
primaryTermSlug: o == null ? void 0 : o.slug,
|
|
659
|
+
language: t,
|
|
660
|
+
config: s
|
|
661
|
+
}), c = B(a, l), g = (r.excerpt && r.excerpt.trim().length > 0 ? r.excerpt : se(r.contentMarkdown, 300)).trim(), d = ((u = (p = n.publishedAt) == null ? void 0 : p.toMillis) == null ? void 0 : u.call(p)) ?? ((h = (f = n.updatedAt) == null ? void 0 : f.toMillis) == null ? void 0 : h.call(f)) ?? ((L = (S = n.createdAt) == null ? void 0 : S.toMillis) == null ? void 0 : L.call(S)) ?? Date.now();
|
|
662
|
+
return {
|
|
663
|
+
title: r.title,
|
|
664
|
+
link: c,
|
|
665
|
+
guid: c,
|
|
666
|
+
description: g,
|
|
667
|
+
pubDateMs: d,
|
|
668
|
+
category: i == null ? void 0 : i.name
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
function st(n, e, t) {
|
|
672
|
+
const s = y(t, e), a = s ? "" : `${e}/`, r = n.terms.map((i) => {
|
|
673
|
+
if (i.type !== "category") return i;
|
|
674
|
+
const l = s ? R(i) : $(i, e);
|
|
675
|
+
return l ? {
|
|
676
|
+
...i,
|
|
677
|
+
name: l.name,
|
|
678
|
+
slug: `${a}${l.slug}`,
|
|
679
|
+
description: l.description
|
|
680
|
+
} : i;
|
|
681
|
+
}), o = (i) => {
|
|
682
|
+
const l = s ? O(i) : C(i, e);
|
|
683
|
+
if (!l) return null;
|
|
684
|
+
const c = i.type !== "post" || !i.primaryTermId;
|
|
685
|
+
return {
|
|
686
|
+
...i,
|
|
687
|
+
title: l.title,
|
|
688
|
+
slug: c ? `${a}${l.slug}` : l.slug,
|
|
689
|
+
contentMarkdown: l.contentMarkdown,
|
|
690
|
+
excerpt: l.excerpt,
|
|
691
|
+
seo: l.seo
|
|
692
|
+
};
|
|
693
|
+
};
|
|
694
|
+
return {
|
|
695
|
+
posts: n.posts.map(o).filter((i) => i !== null),
|
|
696
|
+
pages: n.pages.map(o).filter((i) => i !== null),
|
|
697
|
+
terms: r
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
async function we(n) {
|
|
701
|
+
const e = b(n.settings);
|
|
702
|
+
if (e.enabledLanguages.length !== 0)
|
|
703
|
+
for (const t of e.enabledLanguages) {
|
|
704
|
+
if (y(e, t)) continue;
|
|
705
|
+
const s = st(n, t, e), a = { ...n.settings, language: t }, r = `${t}/data/posts.json`, o = `${t}/data/authors.json`;
|
|
706
|
+
try {
|
|
707
|
+
await xe(
|
|
708
|
+
a,
|
|
709
|
+
s.posts,
|
|
710
|
+
s.pages,
|
|
711
|
+
s.terms,
|
|
712
|
+
n.media,
|
|
713
|
+
r
|
|
714
|
+
);
|
|
715
|
+
} catch {
|
|
716
|
+
}
|
|
717
|
+
try {
|
|
718
|
+
await Pe(
|
|
719
|
+
n.users,
|
|
720
|
+
n.media,
|
|
721
|
+
s.posts,
|
|
722
|
+
s.pages,
|
|
723
|
+
o
|
|
724
|
+
);
|
|
725
|
+
} catch {
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
const Z = ["en", "fr", "de", "es", "nl", "pt", "ko"];
|
|
730
|
+
function at({ config: n, save: e }) {
|
|
731
|
+
const { t } = le("flexweg-multilang"), { settings: s, pages: a } = ie(), [r, o] = Y({
|
|
732
|
+
...H,
|
|
733
|
+
...n
|
|
734
|
+
}), [i, l] = Y(!1);
|
|
735
|
+
async function c() {
|
|
736
|
+
l(!0);
|
|
737
|
+
try {
|
|
738
|
+
await e(r), J.success(t("settings.saved"));
|
|
739
|
+
} catch (u) {
|
|
740
|
+
J.error(u.message || "Save failed");
|
|
741
|
+
} finally {
|
|
742
|
+
l(!1);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
function g(u) {
|
|
746
|
+
o((f) => {
|
|
747
|
+
const S = f.enabledLanguages.includes(u) ? f.enabledLanguages.filter((L) => L !== u) : [...f.enabledLanguages, u];
|
|
748
|
+
return { ...f, enabledLanguages: S };
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
function d(u, f) {
|
|
752
|
+
o((h) => ({
|
|
753
|
+
...h,
|
|
754
|
+
homePages: { ...h.homePages ?? {}, [u]: f || "" }
|
|
755
|
+
}));
|
|
756
|
+
}
|
|
757
|
+
const p = (s.language || "en").split("-")[0];
|
|
758
|
+
return /* @__PURE__ */ v("div", { className: "space-y-6", children: [
|
|
759
|
+
/* @__PURE__ */ v("div", { children: [
|
|
760
|
+
/* @__PURE__ */ m("h2", { className: "font-semibold text-lg", children: t("settings.title") }),
|
|
761
|
+
/* @__PURE__ */ m("p", { className: "text-sm text-surface-500 dark:text-surface-400", children: t("settings.intro") })
|
|
762
|
+
] }),
|
|
763
|
+
/* @__PURE__ */ v("section", { className: "card p-4 space-y-3", children: [
|
|
764
|
+
/* @__PURE__ */ m("h3", { className: "font-medium", children: t("settings.primaryLanguage.title") }),
|
|
765
|
+
/* @__PURE__ */ m("p", { className: "text-xs text-surface-500 dark:text-surface-400", children: t("settings.primaryLanguage.help") }),
|
|
766
|
+
/* @__PURE__ */ v("div", { className: "flex flex-wrap gap-2", children: [
|
|
767
|
+
/* @__PURE__ */ m(
|
|
768
|
+
"select",
|
|
769
|
+
{
|
|
770
|
+
className: "input max-w-[200px]",
|
|
771
|
+
value: r.primaryLanguage,
|
|
772
|
+
onChange: (u) => o({ ...r, primaryLanguage: u.target.value }),
|
|
773
|
+
children: Z.map((u) => /* @__PURE__ */ m("option", { value: u, children: u.toUpperCase() }, u))
|
|
774
|
+
}
|
|
775
|
+
),
|
|
776
|
+
/* @__PURE__ */ m("span", { className: "text-[11px] text-surface-500 self-center", children: t("settings.primaryLanguage.siteHint", { lang: p }) })
|
|
777
|
+
] })
|
|
778
|
+
] }),
|
|
779
|
+
/* @__PURE__ */ v("section", { className: "card p-4 space-y-3", children: [
|
|
780
|
+
/* @__PURE__ */ m("h3", { className: "font-medium", children: t("settings.enabledLanguages.title") }),
|
|
781
|
+
/* @__PURE__ */ m("p", { className: "text-xs text-surface-500 dark:text-surface-400", children: t("settings.enabledLanguages.help") }),
|
|
782
|
+
/* @__PURE__ */ m("div", { className: "flex flex-wrap gap-2", children: Z.filter((u) => u !== r.primaryLanguage).map((u) => {
|
|
783
|
+
const f = r.enabledLanguages.includes(u);
|
|
784
|
+
return /* @__PURE__ */ m(
|
|
785
|
+
"button",
|
|
786
|
+
{
|
|
787
|
+
type: "button",
|
|
788
|
+
onClick: () => g(u),
|
|
789
|
+
className: "text-xs px-3 py-1.5 rounded uppercase font-medium " + (f ? "bg-surface-900 text-surface-50 dark:bg-surface-100 dark:text-surface-900" : "bg-surface-100 text-surface-700 dark:bg-surface-800 dark:text-surface-300"),
|
|
790
|
+
children: u
|
|
791
|
+
},
|
|
792
|
+
u
|
|
793
|
+
);
|
|
794
|
+
}) })
|
|
795
|
+
] }),
|
|
796
|
+
r.enabledLanguages.length > 0 && /* @__PURE__ */ v("section", { className: "card p-4 space-y-3", children: [
|
|
797
|
+
/* @__PURE__ */ m("h3", { className: "font-medium", children: t("settings.homePages.title") }),
|
|
798
|
+
/* @__PURE__ */ m("p", { className: "text-xs text-surface-500 dark:text-surface-400", children: t("settings.homePages.help") }),
|
|
799
|
+
/* @__PURE__ */ m("div", { className: "space-y-2", children: r.enabledLanguages.map((u) => {
|
|
800
|
+
var f;
|
|
801
|
+
return /* @__PURE__ */ v("div", { className: "flex items-center gap-2", children: [
|
|
802
|
+
/* @__PURE__ */ m("span", { className: "text-[10px] uppercase font-semibold w-8", children: u }),
|
|
803
|
+
/* @__PURE__ */ v(
|
|
804
|
+
"select",
|
|
805
|
+
{
|
|
806
|
+
className: "input flex-1",
|
|
807
|
+
value: ((f = r.homePages) == null ? void 0 : f[u]) ?? "",
|
|
808
|
+
onChange: (h) => d(u, h.target.value),
|
|
809
|
+
children: [
|
|
810
|
+
/* @__PURE__ */ m("option", { value: "", children: t("settings.homePages.none") }),
|
|
811
|
+
a.filter((h) => h.status === "online").map((h) => /* @__PURE__ */ m("option", { value: h.id, children: h.title }, h.id))
|
|
812
|
+
]
|
|
813
|
+
}
|
|
814
|
+
)
|
|
815
|
+
] }, u);
|
|
816
|
+
}) })
|
|
817
|
+
] }),
|
|
818
|
+
r.enabledLanguages.length > 0 && /* @__PURE__ */ v("section", { className: "card p-4 space-y-3", children: [
|
|
819
|
+
/* @__PURE__ */ m("h3", { className: "font-medium", children: t("settings.switcher.title") }),
|
|
820
|
+
/* @__PURE__ */ m("p", { className: "text-xs text-surface-500 dark:text-surface-400", children: t("settings.switcher.help") }),
|
|
821
|
+
/* @__PURE__ */ v("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
822
|
+
/* @__PURE__ */ m(
|
|
823
|
+
"input",
|
|
824
|
+
{
|
|
825
|
+
type: "checkbox",
|
|
826
|
+
checked: r.showHeaderSwitcher ?? !0,
|
|
827
|
+
onChange: (u) => o({ ...r, showHeaderSwitcher: u.target.checked })
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
/* @__PURE__ */ m("span", { children: t("settings.switcher.header") })
|
|
831
|
+
] }),
|
|
832
|
+
/* @__PURE__ */ v("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
833
|
+
/* @__PURE__ */ m(
|
|
834
|
+
"input",
|
|
835
|
+
{
|
|
836
|
+
type: "checkbox",
|
|
837
|
+
checked: r.showFooterSwitcher ?? !1,
|
|
838
|
+
onChange: (u) => o({ ...r, showFooterSwitcher: u.target.checked })
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
/* @__PURE__ */ m("span", { children: t("settings.switcher.footer") })
|
|
842
|
+
] })
|
|
843
|
+
] }),
|
|
844
|
+
/* @__PURE__ */ m("div", { className: "flex gap-2", children: /* @__PURE__ */ m(
|
|
845
|
+
"button",
|
|
846
|
+
{
|
|
847
|
+
type: "button",
|
|
848
|
+
className: "btn-primary",
|
|
849
|
+
onClick: c,
|
|
850
|
+
disabled: i,
|
|
851
|
+
children: t(i ? "settings.saving" : "settings.save")
|
|
852
|
+
}
|
|
853
|
+
) })
|
|
854
|
+
] });
|
|
855
|
+
}
|
|
856
|
+
function rt({ term: n, updateTerm: e }) {
|
|
857
|
+
const { t } = le("flexweg-multilang"), { settings: s } = ie(), a = b(s);
|
|
858
|
+
if (a.enabledLanguages.length === 0)
|
|
859
|
+
return /* @__PURE__ */ m("p", { className: "text-xs text-surface-500 dark:text-surface-400", children: t("termSection.noLanguages") });
|
|
860
|
+
const r = n.translations ?? {};
|
|
861
|
+
function o(i, l) {
|
|
862
|
+
const c = {
|
|
863
|
+
...r,
|
|
864
|
+
[i]: { ...r[i] ?? ee(), ...l }
|
|
865
|
+
};
|
|
866
|
+
e({ translations: c });
|
|
867
|
+
}
|
|
868
|
+
return /* @__PURE__ */ v("div", { className: "space-y-2", children: [
|
|
869
|
+
/* @__PURE__ */ m("p", { className: "text-[11px] uppercase tracking-wide font-semibold text-surface-500 dark:text-surface-400", children: t("termSection.title") }),
|
|
870
|
+
a.enabledLanguages.map((i) => {
|
|
871
|
+
const l = r[i] ?? ee(), c = l.slug && !oe(l.slug), g = l.seo ?? {};
|
|
872
|
+
function d(p) {
|
|
873
|
+
o(i, { seo: { ...g, ...p } });
|
|
874
|
+
}
|
|
875
|
+
return /* @__PURE__ */ v("div", { className: "space-y-2 border-t border-surface-200 dark:border-surface-700 pt-2 first:border-t-0 first:pt-0", children: [
|
|
876
|
+
/* @__PURE__ */ v("div", { className: "flex flex-wrap items-start gap-2", children: [
|
|
877
|
+
/* @__PURE__ */ m("span", { className: "text-[10px] uppercase font-semibold w-8 pt-2 text-surface-500", children: i }),
|
|
878
|
+
/* @__PURE__ */ m(
|
|
879
|
+
"input",
|
|
880
|
+
{
|
|
881
|
+
type: "text",
|
|
882
|
+
className: "input flex-1 min-w-[120px]",
|
|
883
|
+
placeholder: t("termSection.name"),
|
|
884
|
+
value: l.name,
|
|
885
|
+
onChange: (p) => o(i, { name: p.target.value })
|
|
886
|
+
}
|
|
887
|
+
),
|
|
888
|
+
/* @__PURE__ */ v("div", { className: "flex-1 min-w-[120px]", children: [
|
|
889
|
+
/* @__PURE__ */ m(
|
|
890
|
+
"input",
|
|
891
|
+
{
|
|
892
|
+
type: "text",
|
|
893
|
+
className: "input",
|
|
894
|
+
placeholder: t("termSection.slug"),
|
|
895
|
+
value: l.slug,
|
|
896
|
+
onChange: (p) => o(i, { slug: p.target.value })
|
|
897
|
+
}
|
|
898
|
+
),
|
|
899
|
+
c && /* @__PURE__ */ m("p", { className: "text-[10px] text-red-600 mt-0.5", children: t("termSection.invalidSlug") })
|
|
900
|
+
] })
|
|
901
|
+
] }),
|
|
902
|
+
/* @__PURE__ */ v("div", { className: "pl-10 space-y-1", children: [
|
|
903
|
+
/* @__PURE__ */ m(
|
|
904
|
+
"input",
|
|
905
|
+
{
|
|
906
|
+
type: "text",
|
|
907
|
+
className: "input w-full",
|
|
908
|
+
placeholder: t("termSection.seoTitle"),
|
|
909
|
+
value: g.title ?? "",
|
|
910
|
+
onChange: (p) => d({ title: p.target.value })
|
|
911
|
+
}
|
|
912
|
+
),
|
|
913
|
+
/* @__PURE__ */ m(
|
|
914
|
+
"textarea",
|
|
915
|
+
{
|
|
916
|
+
className: "input w-full min-h-[60px] resize-y",
|
|
917
|
+
placeholder: t("termSection.seoDescription"),
|
|
918
|
+
value: g.description ?? "",
|
|
919
|
+
onChange: (p) => d({ description: p.target.value })
|
|
920
|
+
}
|
|
921
|
+
)
|
|
922
|
+
] })
|
|
923
|
+
] }, i);
|
|
924
|
+
})
|
|
925
|
+
] });
|
|
926
|
+
}
|
|
927
|
+
function ee() {
|
|
928
|
+
return { slug: "", name: "", description: "" };
|
|
929
|
+
}
|
|
930
|
+
function be(n, e, t) {
|
|
931
|
+
if (t)
|
|
932
|
+
return {
|
|
933
|
+
title: n.title,
|
|
934
|
+
slug: n.slug,
|
|
935
|
+
contentMarkdown: n.contentMarkdown,
|
|
936
|
+
excerpt: n.excerpt,
|
|
937
|
+
seo: n.seo
|
|
938
|
+
};
|
|
939
|
+
const s = n.translations, a = s == null ? void 0 : s[e];
|
|
940
|
+
return !a || !a.title ? null : {
|
|
941
|
+
title: a.title ?? "",
|
|
942
|
+
slug: a.slug ?? "",
|
|
943
|
+
contentMarkdown: a.contentMarkdown ?? "",
|
|
944
|
+
excerpt: a.excerpt,
|
|
945
|
+
seo: a.seo
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
function te(n, e, t) {
|
|
949
|
+
if (t) return "★";
|
|
950
|
+
const s = be(n, e, !1);
|
|
951
|
+
return s && s.slug && s.title ? "" : "○";
|
|
952
|
+
}
|
|
953
|
+
const it = {
|
|
954
|
+
id: "flexweg-multilang/languages",
|
|
955
|
+
priority: 50,
|
|
956
|
+
listVariants(n, e) {
|
|
957
|
+
const t = b(e.settings);
|
|
958
|
+
if (t.enabledLanguages.length === 0) return [];
|
|
959
|
+
const s = [], a = /* @__PURE__ */ new Set();
|
|
960
|
+
s.push({
|
|
961
|
+
id: t.primaryLanguage,
|
|
962
|
+
label: t.primaryLanguage.toUpperCase(),
|
|
963
|
+
badge: te(n, t.primaryLanguage, !0),
|
|
964
|
+
primary: !0
|
|
965
|
+
}), a.add(t.primaryLanguage);
|
|
966
|
+
for (const r of t.enabledLanguages)
|
|
967
|
+
a.has(r) || (a.add(r), s.push({
|
|
968
|
+
id: r,
|
|
969
|
+
label: r.toUpperCase(),
|
|
970
|
+
badge: te(n, r, !1),
|
|
971
|
+
primary: !1
|
|
972
|
+
}));
|
|
973
|
+
return s;
|
|
974
|
+
},
|
|
975
|
+
loadFields(n, e, t) {
|
|
976
|
+
const s = b(t.settings), a = y(s, e);
|
|
977
|
+
return be(n, e, a);
|
|
978
|
+
},
|
|
979
|
+
validate(n, e, t, s) {
|
|
980
|
+
const a = b(s.settings);
|
|
981
|
+
return y(a, e) ? null : t.title.trim() ? oe(t.slug) ? null : `Invalid slug for ${e.toUpperCase()}.` : `Title required for ${e.toUpperCase()}.`;
|
|
982
|
+
},
|
|
983
|
+
async saveFields(n, e, t, s) {
|
|
984
|
+
const a = b(s.settings);
|
|
985
|
+
if (y(a, e))
|
|
986
|
+
return;
|
|
987
|
+
const r = n.translations ?? {}, o = {
|
|
988
|
+
title: t.title,
|
|
989
|
+
slug: t.slug,
|
|
990
|
+
contentMarkdown: t.contentMarkdown
|
|
991
|
+
};
|
|
992
|
+
if (t.excerpt && (o.excerpt = t.excerpt), t.seo) {
|
|
993
|
+
const l = {};
|
|
994
|
+
t.seo.title && (l.title = t.seo.title), t.seo.description && (l.description = t.seo.description), t.seo.ogImage && (l.ogImage = t.seo.ogImage), Object.keys(l).length > 0 && (o.seo = l);
|
|
995
|
+
}
|
|
996
|
+
const i = { ...r, [e]: o };
|
|
997
|
+
try {
|
|
998
|
+
await re(n.id, { translations: i });
|
|
999
|
+
} catch (l) {
|
|
1000
|
+
throw J.error(l.message), l;
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
getSlugPathPrefix(n, e, t, s) {
|
|
1004
|
+
var g;
|
|
1005
|
+
const a = b(s.settings), r = y(a, e) ? "" : `${e}/`;
|
|
1006
|
+
if (n.type !== "post" || !n.primaryTermId) return r;
|
|
1007
|
+
const o = s.terms.find((d) => d.id === n.primaryTermId);
|
|
1008
|
+
if (!o) return r;
|
|
1009
|
+
const i = o.translations, c = !y(a, e) && ((g = i == null ? void 0 : i[e]) == null ? void 0 : g.slug) || o.slug;
|
|
1010
|
+
return `${r}${c}/`;
|
|
1011
|
+
}
|
|
1012
|
+
}, ot = `
|
|
1013
|
+
.cms-langswitch{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:1;letter-spacing:0.05em;}
|
|
1014
|
+
.cms-langswitch a,.cms-langswitch span{padding:4px 8px;border-radius:4px;text-decoration:none;color:inherit;text-transform:uppercase;font-weight:600;}
|
|
1015
|
+
.cms-langswitch a{opacity:0.55;}
|
|
1016
|
+
.cms-langswitch a:hover{opacity:1;}
|
|
1017
|
+
.cms-langswitch__current{background:currentColor;color:transparent;position:relative;}
|
|
1018
|
+
.cms-langswitch__current::after{content:attr(data-label);position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--cms-langswitch-on,white);mix-blend-mode:difference;}
|
|
1019
|
+
`.replace(/\s+/g, " ").trim();
|
|
1020
|
+
function lt(n) {
|
|
1021
|
+
return n.replace(/[<>&\u2028\u2029]/g, (e) => e === "<" ? "\\u003c" : e === ">" ? "\\u003e" : e === "&" ? "\\u0026" : e === "\u2028" ? "\\u2028" : "\\u2029");
|
|
1022
|
+
}
|
|
1023
|
+
function ct(n) {
|
|
1024
|
+
const { config: e, settings: t, currentPath: s } = n;
|
|
1025
|
+
if (e.enabledLanguages.length === 0 || !e.showHeaderSwitcher && !e.showFooterSwitcher) return "";
|
|
1026
|
+
const a = Fe(s);
|
|
1027
|
+
if (!a || a.alternates.length < 2) return "";
|
|
1028
|
+
const r = (t.baseUrl || "").replace(/\/+$/, ""), o = a.alternates.map((p) => ({
|
|
1029
|
+
lang: p.language,
|
|
1030
|
+
label: p.language.toUpperCase(),
|
|
1031
|
+
href: r ? B(r, p.path) : `/${p.path.replace(/^\/+/, "")}`
|
|
1032
|
+
})), i = a.language, l = e.primaryLanguage, c = {
|
|
1033
|
+
current: i,
|
|
1034
|
+
primary: l,
|
|
1035
|
+
items: o,
|
|
1036
|
+
showHeader: e.showHeaderSwitcher !== !1,
|
|
1037
|
+
showFooter: e.showFooterSwitcher === !0
|
|
1038
|
+
};
|
|
1039
|
+
return `<script>${`
|
|
1040
|
+
(function(){
|
|
1041
|
+
try {
|
|
1042
|
+
var D = ${lt(JSON.stringify(c))};
|
|
1043
|
+
function render(host) {
|
|
1044
|
+
var html = '<div class="cms-langswitch" role="navigation" aria-label="Language">';
|
|
1045
|
+
for (var i = 0; i < D.items.length; i++) {
|
|
1046
|
+
var it = D.items[i];
|
|
1047
|
+
if (it.lang === D.current) {
|
|
1048
|
+
html += '<span class="cms-langswitch__current" data-label="' + it.label + '" aria-current="true">' + it.label + '</span>';
|
|
1049
|
+
} else {
|
|
1050
|
+
html += '<a href="' + it.href + '" hreflang="' + it.lang + '" rel="alternate">' + it.label + '</a>';
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
html += '</div>';
|
|
1054
|
+
host.innerHTML = html;
|
|
1055
|
+
host.removeAttribute('data-cms-langswitch-empty');
|
|
1056
|
+
}
|
|
1057
|
+
function paint() {
|
|
1058
|
+
if (D.showHeader) {
|
|
1059
|
+
var h = document.querySelector('[data-cms-langswitch="header"]');
|
|
1060
|
+
if (h) render(h);
|
|
1061
|
+
}
|
|
1062
|
+
if (D.showFooter) {
|
|
1063
|
+
var f = document.querySelector('[data-cms-langswitch="footer"]');
|
|
1064
|
+
if (f) render(f);
|
|
1065
|
+
}
|
|
1066
|
+
var s = document.createElement('style');
|
|
1067
|
+
s.setAttribute('data-cms-langswitch-css', '');
|
|
1068
|
+
s.textContent = ${JSON.stringify(ot)};
|
|
1069
|
+
document.head.appendChild(s);
|
|
1070
|
+
}
|
|
1071
|
+
if (document.readyState !== 'loading') paint();
|
|
1072
|
+
else document.addEventListener('DOMContentLoaded', paint);
|
|
1073
|
+
} catch (e) {}
|
|
1074
|
+
})();`}<\/script>`;
|
|
1075
|
+
}
|
|
1076
|
+
async function ut(n, e) {
|
|
1077
|
+
const t = b(e.settings);
|
|
1078
|
+
fe(t), he(e.terms), I(e.posts, e.pages, e.terms, e.settings, t), A(e.posts, e.pages, e.terms, t), await ye(e), await we(e);
|
|
1079
|
+
}
|
|
1080
|
+
async function ne(n, e) {
|
|
1081
|
+
const t = b(e.settings);
|
|
1082
|
+
fe(t), he(e.terms), I(e.posts, e.pages, e.terms, e.settings, t), A(e.posts, e.pages, e.terms, t), await ye(e), await we(e);
|
|
1083
|
+
}
|
|
1084
|
+
async function gt() {
|
|
1085
|
+
try {
|
|
1086
|
+
const n = window, e = n == null ? void 0 : n.__FLEXWEG_LIVE_SETTINGS__;
|
|
1087
|
+
if (!e) return;
|
|
1088
|
+
const t = b(e);
|
|
1089
|
+
if (t.enabledLanguages.length === 0) return;
|
|
1090
|
+
const [s, a] = await Promise.all([
|
|
1091
|
+
K({ type: "post" }),
|
|
1092
|
+
K({ type: "page" })
|
|
1093
|
+
]);
|
|
1094
|
+
I(s, a, [], e, t), A(s, a, [], t);
|
|
1095
|
+
} catch {
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
const ht = {
|
|
1099
|
+
id: "flexweg-multilang",
|
|
1100
|
+
name: "Multi-language",
|
|
1101
|
+
version: "1.0.0",
|
|
1102
|
+
description: "Multi-language site support — translated posts/pages/terms, hreflang SEO, per-language sitemap entries, per-language RSS feeds.",
|
|
1103
|
+
author: "Flexweg",
|
|
1104
|
+
i18n: { en: Ce, fr: Ee },
|
|
1105
|
+
settings: {
|
|
1106
|
+
navLabelKey: "settings.title",
|
|
1107
|
+
defaultConfig: H,
|
|
1108
|
+
component: at
|
|
1109
|
+
},
|
|
1110
|
+
register(n) {
|
|
1111
|
+
n.addFilter("publish.additional", async (e, t, s) => Re(
|
|
1112
|
+
e,
|
|
1113
|
+
t,
|
|
1114
|
+
s
|
|
1115
|
+
)), n.addFilter("publish.extraListings", async (e, t) => qe(
|
|
1116
|
+
e,
|
|
1117
|
+
t
|
|
1118
|
+
)), n.addAction("publish.before", async (e, t) => {
|
|
1119
|
+
const s = t, a = b(s.settings);
|
|
1120
|
+
I(s.posts, s.pages, s.terms, s.settings, a), A(s.posts, s.pages, s.terms, a);
|
|
1121
|
+
}), n.addAction("regenerate.listings.before", async (e) => {
|
|
1122
|
+
const t = e, s = b(t.settings);
|
|
1123
|
+
I(t.posts, t.pages, t.terms, t.settings, s), A(t.posts, t.pages, t.terms, s);
|
|
1124
|
+
}), n.addAction("publish.complete", async (e, t) => {
|
|
1125
|
+
await ut(e, t);
|
|
1126
|
+
}), n.addAction("post.unpublished", async (e, t) => {
|
|
1127
|
+
await ne(e, t);
|
|
1128
|
+
}), n.addAction("post.deleted", async (e, t) => {
|
|
1129
|
+
await ne(e, t);
|
|
1130
|
+
}), n.addFilter("page.head.extra", (e, ...t) => {
|
|
1131
|
+
const s = t[0];
|
|
1132
|
+
if (!(s != null && s.currentPath)) return e;
|
|
1133
|
+
const a = De(s.currentPath);
|
|
1134
|
+
return a ? e + (e ? `
|
|
1135
|
+
` : "") + a : e;
|
|
1136
|
+
}), n.addFilter("page.body.end", (e, ...t) => {
|
|
1137
|
+
var o;
|
|
1138
|
+
const s = t[0];
|
|
1139
|
+
if (!(s != null && s.currentPath) || !((o = s == null ? void 0 : s.site) != null && o.settings)) return e;
|
|
1140
|
+
const a = b(s.site.settings), r = ct({
|
|
1141
|
+
config: a,
|
|
1142
|
+
settings: s.site.settings,
|
|
1143
|
+
currentPath: s.currentPath
|
|
1144
|
+
});
|
|
1145
|
+
return r ? e + (e ? `
|
|
1146
|
+
` : "") + r : e;
|
|
1147
|
+
}), n.addFilter(
|
|
1148
|
+
"sitemap.urlset.namespaces",
|
|
1149
|
+
(e) => je(e)
|
|
1150
|
+
), n.addFilter("sitemap.url.entry", (e, ...t) => {
|
|
1151
|
+
const s = t[0];
|
|
1152
|
+
return Je(e, s);
|
|
1153
|
+
}), n.addFilter("sitemap.urls.extra", (e, ...t) => {
|
|
1154
|
+
const s = t[0];
|
|
1155
|
+
return Ge(
|
|
1156
|
+
e,
|
|
1157
|
+
s
|
|
1158
|
+
);
|
|
1159
|
+
}), n.addFilter("sitemap.index.extra", (e, ...t) => {
|
|
1160
|
+
const s = t[0];
|
|
1161
|
+
return Be(
|
|
1162
|
+
e,
|
|
1163
|
+
s
|
|
1164
|
+
);
|
|
1165
|
+
}), n.addFilter("sitemap.news.locales", (e, ...t) => {
|
|
1166
|
+
const s = t[0];
|
|
1167
|
+
return Ve(
|
|
1168
|
+
e,
|
|
1169
|
+
s
|
|
1170
|
+
);
|
|
1171
|
+
}), n.addFilter("rss.site.locales", (e, ...t) => {
|
|
1172
|
+
const s = t[0];
|
|
1173
|
+
return s ? [
|
|
1174
|
+
...e,
|
|
1175
|
+
...et(s)
|
|
1176
|
+
] : e;
|
|
1177
|
+
}), n.registerEditorVariantProvider(it), n.registerTermEditorSection({
|
|
1178
|
+
id: "flexweg-multilang/term-translations",
|
|
1179
|
+
termType: "all",
|
|
1180
|
+
priority: 50,
|
|
1181
|
+
component: rt
|
|
1182
|
+
}), gt();
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
export {
|
|
1186
|
+
ht as default
|
|
1187
|
+
};
|