@rmdes/indiekit-endpoint-site-config 1.0.0-beta.7 → 1.0.0-beta.9
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.
|
@@ -7,6 +7,20 @@ import { LAYOUT_PRESETS } from "../presets/layout-presets.js";
|
|
|
7
7
|
|
|
8
8
|
const VALID_LAYOUTS = new Set(["single-column", "two-column", "full-width-hero"]);
|
|
9
9
|
|
|
10
|
+
// Hero "read more" CTA: accept a root-relative path or absolute URL, else fall
|
|
11
|
+
// back to /about. Text is free-form (localizable per site), defaulting to "Read more".
|
|
12
|
+
function safeHeroLink(raw, fallback = "/about/") {
|
|
13
|
+
const v = typeof raw === "string" ? raw.trim() : "";
|
|
14
|
+
if (!v) return fallback;
|
|
15
|
+
if (v.startsWith("/")) return v;
|
|
16
|
+
try { new URL(v); return v; } catch { return fallback; }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function safeHeroText(raw, fallback = "Read more") {
|
|
20
|
+
const v = typeof raw === "string" ? raw.trim() : "";
|
|
21
|
+
return v || fallback;
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
export function parseEntryArray(value) {
|
|
11
25
|
if (Array.isArray(value)) return value;
|
|
12
26
|
if (typeof value === "string") {
|
|
@@ -33,6 +47,8 @@ export function parseHomepageBody(body) {
|
|
|
33
47
|
hero: {
|
|
34
48
|
enabled: body.heroEnabled === "on" || body.heroEnabled === true,
|
|
35
49
|
showSocial: body.heroShowSocial === "on" || body.heroShowSocial === true,
|
|
50
|
+
ctaText: safeHeroText(body.heroCtaText),
|
|
51
|
+
ctaUrl: safeHeroLink(body.heroCtaUrl),
|
|
36
52
|
},
|
|
37
53
|
sections: parseEntryArray(body.sections),
|
|
38
54
|
sidebar: parseEntryArray(body.sidebar),
|
|
@@ -20,6 +20,11 @@ export const DEFAULTS_HOMEPAGE = Object.freeze({
|
|
|
20
20
|
hero: Object.freeze({
|
|
21
21
|
enabled: true,
|
|
22
22
|
showSocial: true,
|
|
23
|
+
// "Read more" call-to-action shown after the site description in the hero.
|
|
24
|
+
// ctaText is free-text (localize per site, e.g. "À propos"); ctaUrl is the
|
|
25
|
+
// target (default /about — keeps existing sites unchanged).
|
|
26
|
+
ctaText: "Read more",
|
|
27
|
+
ctaUrl: "/about/",
|
|
23
28
|
}),
|
|
24
29
|
sections: Object.freeze([
|
|
25
30
|
Object.freeze({
|
package/locales/en.json
CHANGED
|
@@ -170,7 +170,15 @@
|
|
|
170
170
|
"hero": {
|
|
171
171
|
"title": "Hero Section",
|
|
172
172
|
"enabled": "Show hero section with author info",
|
|
173
|
-
"showSocial": "Show social links in hero"
|
|
173
|
+
"showSocial": "Show social links in hero",
|
|
174
|
+
"ctaText": {
|
|
175
|
+
"label": "“Read more” link text",
|
|
176
|
+
"hint": "Text for the call-to-action shown after the site description (e.g. “Read more”, “À propos”, “En savoir plus”)."
|
|
177
|
+
},
|
|
178
|
+
"ctaUrl": {
|
|
179
|
+
"label": "“Read more” link target",
|
|
180
|
+
"hint": "Where the hero “read more” link points. Defaults to /about; use any path (e.g. /apropos) or a full URL."
|
|
181
|
+
}
|
|
174
182
|
},
|
|
175
183
|
"sections": {
|
|
176
184
|
"title": "Content Sections",
|
package/locales/fr.json
CHANGED
|
@@ -170,7 +170,15 @@
|
|
|
170
170
|
"hero": {
|
|
171
171
|
"title": "Section Hero",
|
|
172
172
|
"enabled": "Afficher la section hero avec les informations sur l'auteur",
|
|
173
|
-
"showSocial": "Afficher les liens sociaux dans le hero"
|
|
173
|
+
"showSocial": "Afficher les liens sociaux dans le hero",
|
|
174
|
+
"ctaText": {
|
|
175
|
+
"label": "Texte du lien « en savoir plus »",
|
|
176
|
+
"hint": "Texte de l'appel à l'action affiché après la description du site (ex. « À propos », « En savoir plus »)."
|
|
177
|
+
},
|
|
178
|
+
"ctaUrl": {
|
|
179
|
+
"label": "Cible du lien « en savoir plus »",
|
|
180
|
+
"hint": "Destination du lien « en savoir plus » du hero. Par défaut /about ; utilisez un chemin (ex. /apropos) ou une URL complète."
|
|
181
|
+
}
|
|
174
182
|
},
|
|
175
183
|
"sections": {
|
|
176
184
|
"title": "Sections de contenu",
|
package/package.json
CHANGED
|
@@ -400,6 +400,18 @@
|
|
|
400
400
|
{{ __("siteConfig.homepage.hero.showSocial") }}
|
|
401
401
|
</label>
|
|
402
402
|
</div>
|
|
403
|
+
<div class="field">
|
|
404
|
+
<label class="field__label" for="heroCtaText">{{ __("siteConfig.homepage.hero.ctaText.label") }}</label>
|
|
405
|
+
<input class="field__input" type="text" id="heroCtaText" name="heroCtaText"
|
|
406
|
+
value="{{ homepage.hero.ctaText or 'Read more' }}" placeholder="Read more">
|
|
407
|
+
<p class="field__hint">{{ __("siteConfig.homepage.hero.ctaText.hint") }}</p>
|
|
408
|
+
</div>
|
|
409
|
+
<div class="field">
|
|
410
|
+
<label class="field__label" for="heroCtaUrl">{{ __("siteConfig.homepage.hero.ctaUrl.label") }}</label>
|
|
411
|
+
<input class="field__input" type="text" id="heroCtaUrl" name="heroCtaUrl"
|
|
412
|
+
value="{{ homepage.hero.ctaUrl or '/about' }}" placeholder="/about">
|
|
413
|
+
<p class="field__hint">{{ __("siteConfig.homepage.hero.ctaUrl.hint") }}</p>
|
|
414
|
+
</div>
|
|
403
415
|
</section>
|
|
404
416
|
|
|
405
417
|
{# Content Sections #}
|