Remove .html from internal links
Some checks are pending
/ deploy (push) Waiting to run

This commit is contained in:
Loyyd 2026-07-02 19:44:40 +02:00
parent 670d90cb15
commit f85aca7d58
43 changed files with 202 additions and 97 deletions

File diff suppressed because one or more lines are too long

View file

@ -27,4 +27,4 @@ tags:
<p>15 Min Break</p>
<p><strong>3:00pm -3:45pm Intro to <a href="https://alphausa.org/the-marriage-course">The Marriage Course</a></strong></p>
<p>Families and guests are welcome to join and celebrate your marriage with you. Well be able to put on a movie and have someone available to watch and entertain any younger kids during the program.</p>
<p>Spaces are limited so please<a href="/register.html"> register today</a> to be part of this special celebration.</p>
<p>Spaces are limited so please<a href="/register"> register today</a> to be part of this special celebration.</p>

View file

@ -4,6 +4,7 @@ import path from "node:path";
const repoRoot = process.cwd();
const distRoot = path.join(repoRoot, "dist");
const htmlAttributes = ["href", "src", "poster", "action"];
const internalHosts = new Set(["familyfed.ie", "www.familyfed.ie", "familyfed.bcgen.ie"]);
const assetExtensions = new Set([
".avif",
".css",
@ -98,6 +99,15 @@ function listFiles(dir) {
}
function checkReference({ sourceFile, rawReference, sourceKind }) {
if ((sourceKind === "href" || sourceKind === "action") && isInternalHtmlPageReference(rawReference)) {
problems.push({
sourceFile,
sourceKind,
rawReference,
reason: "internal page links should omit the .html extension",
});
}
const reference = normalizeReference(rawReference);
if (!reference) {
@ -140,6 +150,33 @@ function checkReference({ sourceFile, rawReference, sourceKind }) {
return 1;
}
function isInternalHtmlPageReference(rawReference) {
const trimmed = rawReference.trim();
if (
trimmed === "" ||
trimmed.startsWith("#") ||
trimmed.startsWith("data:") ||
trimmed.startsWith("blob:") ||
trimmed.startsWith("//") ||
trimmed.startsWith("?")
) {
return false;
}
const absoluteMatch = trimmed.match(/^https?:\/\/([^/?#]+)([^?#]*)(?:[?#].*)?$/i);
if (absoluteMatch) {
const [, host, pathname] = absoluteMatch;
return internalHosts.has(host.toLowerCase()) && pathname.toLowerCase().endsWith(".html");
}
if (ignoredProtocols.test(trimmed)) {
return false;
}
const pathname = trimmed.split("#")[0].split("?")[0];
return pathname.toLowerCase().endsWith(".html");
}
function normalizeReference(rawReference) {
if (!rawReference) {
return "";

View file

@ -11,6 +11,36 @@ function copyDir(source, destination) {
fs.cpSync(source, destination, { recursive: true });
}
function listHtmlFiles(dir) {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
return listHtmlFiles(fullPath);
}
return entry.isFile() && entry.name.endsWith(".html") ? [fullPath] : [];
});
}
function materializeExtensionlessHtmlRoutes() {
let routes = 0;
for (const filePath of listHtmlFiles(distRoot)) {
const relativePath = path.relative(distRoot, filePath);
const extensionlessPath = relativePath.replace(/\.html$/, "");
const destination = path.join(distRoot, extensionlessPath, "index.html");
if (path.resolve(destination) === path.resolve(filePath)) {
continue;
}
fs.mkdirSync(path.dirname(destination), { recursive: true });
fs.copyFileSync(filePath, destination);
routes += 1;
}
return routes;
}
for (const dir of staticDirs) {
copyDir(path.join(repoRoot, dir), path.join(distRoot, dir));
}
@ -30,4 +60,7 @@ if (fs.existsSync(adminIndexSource)) {
fs.copyFileSync(adminIndexSource, adminIndexDestination);
}
const extensionlessRoutes = materializeExtensionlessHtmlRoutes();
console.log(`Copied ${staticDirs.join(", ")} into dist/.`);
console.log(`Materialized ${extensionlessRoutes} extensionless HTML route aliases.`);

View file

@ -2,6 +2,7 @@
import SiteLayout from "./SiteLayout.astro";
import SiteSidebar from "./SiteSidebar.astro";
import { categoryHref, excerptFromBody, formatDate, slugify, tagHref } from "../lib/archive";
import { stripHtmlExtensionFromInternalUrl } from "../lib/urls";
const {
title,
@ -39,20 +40,21 @@ const {
const tags = entry.data.tags ?? [];
const title = entry.data.title ?? "Untitled";
const publishedDate = formatDate(entry.data.published);
const entryHref = stripHtmlExtensionFromInternalUrl(entry.data.source);
return (
<article class:list={["post", "type-post", "status-publish", "format-standard", "hentry", categories.map((category) => `category-${slugify(category)}`)]}>
<h2 class="entry-title">
<a href={entry.data.source}>{title}</a>
<a href={entryHref}>{title}</a>
</h2>
<div class="entry-meta">
&nbsp; <span class="author vcard">By <a class="url fn n" rel="author" href="#" title="View all posts by Fami1yfed">Fami1yfed</a></span>
{
publishedDate && entry.data.source && (
publishedDate && entryHref && (
<span>
<time class="onDate date published" datetime={entry.data.published}>
{" "}
<a href={entry.data.source} rel="bookmark">{publishedDate}</a>
<a href={entryHref} rel="bookmark">{publishedDate}</a>
{" "}
</time>
</span>
@ -118,4 +120,3 @@ const {
</div>
</div>
</SiteLayout>

View file

@ -1,6 +1,7 @@
---
import SiteFooter from "./SiteFooter.astro";
import SiteNav from "./SiteNav.astro";
import { stripHtmlExtensionFromInternalUrl } from "../lib/urls";
const {
title,
@ -16,7 +17,7 @@ const {
const parabolaSettingsScript = `var parabola_settings = ${JSON.stringify(parabolaSettings)};`;
const siteOrigin = Astro.site?.origin ?? "https://familyfed.ie";
const absoluteUrl = (value) => value ? new URL(value, siteOrigin).toString() : undefined;
const canonicalUrl = absoluteUrl(canonical ?? pathname);
const canonicalUrl = absoluteUrl(stripHtmlExtensionFromInternalUrl(canonical ?? pathname));
const imageUrl = absoluteUrl(image);
const plausibleDomain = import.meta.env.PUBLIC_PLAUSIBLE_DOMAIN ?? "";
const plausibleScriptSrc = import.meta.env.PUBLIC_PLAUSIBLE_SCRIPT_SRC ?? "https://plausible.io/js/script.js";
@ -67,7 +68,7 @@ const metaTitle = title
<div id="branding" role="banner">
<img id="bg_image" alt="Family Federation for World Peace and Unification Ireland" src="/assets/uploads/2013/10/BannerFamilyFed_23_10c1.jpg" />
<div id="header-container">
<a href="/index.html" id="linky" aria-label="FFWPU Ireland home page"></a>
<a href="/index" id="linky" aria-label="FFWPU Ireland home page"></a>
</div>
<div style="clear:both;"></div>
</div>

View file

@ -2,25 +2,25 @@
const { pathname = "/" } = Astro.props;
const navItems = [
{ href: "/index.html", label: "Home", match: ["/index.html", "/"] },
{ href: "/index", label: "Home", match: ["/index", "/"] },
{
href: "/about.html",
href: "/about",
label: "About Us",
match: ["/about.html", "/the-founders.html", "/about-us-organizations.html"],
match: ["/about", "/the-founders", "/about-us-organizations"],
children: [
{ href: "/the-founders.html", label: "The Founders" },
{ href: "/about-us-organizations.html", label: "Organizations" },
{ href: "/the-founders", label: "The Founders" },
{ href: "/about-us-organizations", label: "Organizations" },
],
},
{ href: "/videos.html", label: "Videos", match: ["/videos.html"] },
{ href: "/videos", label: "Videos", match: ["/videos"] },
{
href: "/events.html",
href: "/events",
label: "Events",
match: ["/events.html", "/services.html"],
children: [{ href: "/services.html", label: "Sunday Services" }],
match: ["/events", "/services"],
children: [{ href: "/services", label: "Sunday Services" }],
},
{ href: "/speeches/", label: "Speeches", match: ["/speeches/"] },
{ href: "/contact.html", label: "Contact", match: ["/contact.html"] },
{ href: "/contact", label: "Contact", match: ["/contact"] },
];
function isCurrent(item) {

View file

@ -1,8 +1,8 @@
---
const sidebarItems = [
{ href: "/the-founders.html", label: "The Founders" },
{ href: "/services.html", label: "Sunday Services" },
{ href: "/contact.html", label: "Contact" },
{ href: "/the-founders", label: "The Founders" },
{ href: "/services", label: "Sunday Services" },
{ href: "/contact", label: "Contact" },
{ href: "/speeches/", label: "Speeches" },
];
---

View file

@ -1,7 +1,9 @@
---
import SiteSidebar from "./SiteSidebar.astro";
import { normalizeInternalHtmlLinks } from "../lib/urls";
const { articleHtml } = Astro.props;
const normalizedArticleHtml = normalizeInternalHtmlLinks(articleHtml);
---
<div id="main">
@ -10,7 +12,7 @@ const { articleHtml } = Astro.props;
<section id="container" class="two-columns-right">
<div id="content" role="main">
<Fragment set:html={articleHtml} />
<Fragment set:html={normalizedArticleHtml} />
</div>
<SiteSidebar />
</section>

View file

@ -23,7 +23,7 @@ export const recurringCalendarEvents: RecurringCalendarEvent[] = [
endTime: "12:00",
location: "19 North Great Georges St., Dublin 1, Ireland",
details: "Weekly Sunday Service video upload and community worship.",
url: "/services.html",
url: "/services",
weekday: 0,
},
];

View file

@ -122,13 +122,12 @@ export function speechCategorySlug(category: string): string {
export function categoryHref(entry: ArchiveEntry, category: string): string {
if (entry.data.type === "speech") {
return `/speeches/categories/${speechCategorySlug(category)}.html`;
return `/speeches/categories/${speechCategorySlug(category)}`;
}
return `/blog/categories/${blogCategorySlug(category)}.html`;
return `/blog/categories/${blogCategorySlug(category)}`;
}
export function tagHref(tag: string): string {
return `/blog/tags/${blogTagSlug(tag)}.html`;
return `/blog/tags/${blogTagSlug(tag)}`;
}

View file

@ -1,5 +1,6 @@
import fs from "node:fs";
import path from "node:path";
import { stripHtmlExtensionFromInternalUrl } from "./urls";
const repoRoot = process.cwd();
const speechesRoot = path.join(repoRoot, "content", "speeches");
@ -190,7 +191,7 @@ function itemFromFile(filePath: string): SpeechArchiveItem {
return {
id: relativePath.replace(/\.md$/, ""),
title,
url: frontmatter.source ?? "#",
url: stripHtmlExtensionFromInternalUrl(frontmatter.source) ?? "#",
year,
speaker,
category,

39
src/lib/urls.ts Normal file
View file

@ -0,0 +1,39 @@
const internalHosts = new Set(["familyfed.ie", "www.familyfed.ie", "familyfed.bcgen.ie"]);
const ignoredProtocolPattern = /^(?:mailto|tel|javascript|data|blob):/i;
function splitSuffix(value: string): { pathname: string; suffix: string } {
const match = value.match(/^([^?#]*)([?#].*)?$/);
return {
pathname: match?.[1] ?? value,
suffix: match?.[2] ?? "",
};
}
function stripHtmlPath(pathname: string): string {
return pathname.replace(/\.html$/i, "");
}
export function stripHtmlExtensionFromInternalUrl<T extends string | undefined>(value: T): T {
if (!value || value.startsWith("#") || value.startsWith("?") || value.startsWith("//") || ignoredProtocolPattern.test(value)) {
return value;
}
const absoluteMatch = value.match(/^(https?:\/\/([^/?#]+))([^?#]*)([?#].*)?$/i);
if (absoluteMatch) {
const [, origin, host, pathname = "", suffix = ""] = absoluteMatch;
if (!internalHosts.has(host.toLowerCase())) {
return value;
}
return `${origin}${stripHtmlPath(pathname)}${suffix}` as T;
}
const { pathname, suffix } = splitSuffix(value);
return `${stripHtmlPath(pathname)}${suffix}` as T;
}
export function normalizeInternalHtmlLinks(html = ""): string {
return html.replace(/\b(href|action)=(["'])(.*?)\2/gis, (_match, attr, quote, value) => {
return `${attr}=${quote}${stripHtmlExtensionFromInternalUrl(value)}${quote}`;
});
}

View file

@ -2,5 +2,4 @@
import LegacyRedirectPage from "../components/LegacyRedirectPage.astro";
---
<LegacyRedirectPage title="2013 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2013.html" />
<LegacyRedirectPage title="2013 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2013" />

View file

@ -2,5 +2,4 @@
import LegacyRedirectPage from "../components/LegacyRedirectPage.astro";
---
<LegacyRedirectPage title="2014 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2014.html" />
<LegacyRedirectPage title="2014 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2014" />

View file

@ -2,5 +2,4 @@
import LegacyRedirectPage from "../components/LegacyRedirectPage.astro";
---
<LegacyRedirectPage title="2015 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2015.html" />
<LegacyRedirectPage title="2015 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2015" />

View file

@ -2,5 +2,4 @@
import LegacyRedirectPage from "../components/LegacyRedirectPage.astro";
---
<LegacyRedirectPage title="2016 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2016.html" />
<LegacyRedirectPage title="2016 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2016" />

View file

@ -2,5 +2,4 @@
import LegacyRedirectPage from "../components/LegacyRedirectPage.astro";
---
<LegacyRedirectPage title="2017 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2017.html" />
<LegacyRedirectPage title="2017 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2017" />

View file

@ -2,5 +2,4 @@
import LegacyRedirectPage from "../components/LegacyRedirectPage.astro";
---
<LegacyRedirectPage title="2018 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2018.html" />
<LegacyRedirectPage title="2018 Sunday Services Archive - FFWPU Ireland" target="/archive-sunday-services-2018" />

View file

@ -1,6 +1,7 @@
import fs from "node:fs/promises";
import { contentSourceRoutes } from "../lib/content-routes";
import { isMigratedHtmlPage, relativeWebsitePath, routeFromRelativePath, sourcePathFromRoute, walkHtmlFiles } from "../lib/static-pages";
import { normalizeInternalHtmlLinks } from "../lib/urls";
export async function getStaticPaths() {
const markdownRoutes = await contentSourceRoutes();
@ -16,7 +17,7 @@ export async function getStaticPaths() {
}
export async function GET({ params }: { params: { route?: string } }) {
const html = await fs.readFile(sourcePathFromRoute(params.route), "utf8");
const html = normalizeInternalHtmlLinks(await fs.readFile(sourcePathFromRoute(params.route), "utf8"));
return new Response(html, {
headers: {

View file

@ -10,9 +10,8 @@ const articleHtml = legacyPageArticle("about-us-organizations.html");
title="Organizations &#8211; FFWPU Ireland"
description="Explore organizations connected with Rev. Sun Myung Moon and Dr. Hak Ja Han Moon, including UPF, WFWP, IRFF, and the Unification Church."
bodyClass="page-template page-template-templates page-template-template-twocolumns-right page-template-templatestemplate-twocolumns-right-php page page-id-124 page-child parent-pageid-29 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/about-us-organizations.html"
canonical="/about-us-organizations.html"
pathname="/about-us-organizations"
canonical="/about-us-organizations"
>
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -8,8 +8,8 @@ import articleHtml from "../content/pages/about.html?raw";
title="About Us &#8211; FFWPU Ireland"
description="Learn about the Family Federation for World Peace and Unification in Ireland, its teachings, and its focus on God-centered families."
bodyClass="page-template page-template-templates page-template-template-twocolumns-right page-template-templatestemplate-twocolumns-right-php page page-id-29 page-parent custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/about.html"
canonical="/about.html"
pathname="/about"
canonical="/about"
>
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -837,7 +837,7 @@ const adminConfig = {
</div>
<div class="admin-field">
<label for="event-url">Details URL</label>
<input id="event-url" name="url" placeholder="/events.html" inputmode="url" />
<input id="event-url" name="url" placeholder="/events" inputmode="url" />
</div>
</div>
<div class="admin-field">

View file

@ -6,7 +6,6 @@ import { legacyPageArticle } from "../lib/legacy-page";
const articleHtml = legacyPageArticle("archive-sunday-services-2013.html");
---
<SiteLayout title="2013 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2013." bodyClass="page-template-default page page-id-405 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2013.html" canonical="/archive-sunday-services-2013.html">
<SiteLayout title="2013 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2013." bodyClass="page-template-default page page-id-405 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2013" canonical="/archive-sunday-services-2013">
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -6,7 +6,6 @@ import { legacyPageArticle } from "../lib/legacy-page";
const articleHtml = legacyPageArticle("archive-sunday-services-2014.html");
---
<SiteLayout title="2014 Sunday Services &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2014." bodyClass="page-template-default page page-id-403 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2014.html" canonical="/archive-sunday-services-2014.html">
<SiteLayout title="2014 Sunday Services &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2014." bodyClass="page-template-default page page-id-403 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2014" canonical="/archive-sunday-services-2014">
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -6,7 +6,6 @@ import { legacyPageArticle } from "../lib/legacy-page";
const articleHtml = legacyPageArticle("archive-sunday-services-2015.html");
---
<SiteLayout title="2015 Sunday Services Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2015." bodyClass="page-template-default page page-id-398 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2015.html" canonical="/archive-sunday-services-2015.html">
<SiteLayout title="2015 Sunday Services Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2015." bodyClass="page-template-default page page-id-398 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2015" canonical="/archive-sunday-services-2015">
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -6,7 +6,6 @@ import { legacyPageArticle } from "../lib/legacy-page";
const articleHtml = legacyPageArticle("archive-sunday-services-2016.html");
---
<SiteLayout title="2016 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2016." bodyClass="page-template-default page page-id-396 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2016.html" canonical="/archive-sunday-services-2016.html">
<SiteLayout title="2016 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2016." bodyClass="page-template-default page page-id-396 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2016" canonical="/archive-sunday-services-2016">
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -6,7 +6,6 @@ import { legacyPageArticle } from "../lib/legacy-page";
const articleHtml = legacyPageArticle("archive-sunday-services-2017.html");
---
<SiteLayout title="2017 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2017." bodyClass="page-template-default page page-id-394 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2017.html" canonical="/archive-sunday-services-2017.html">
<SiteLayout title="2017 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2017." bodyClass="page-template-default page page-id-394 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2017" canonical="/archive-sunday-services-2017">
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -6,7 +6,6 @@ import { legacyPageArticle } from "../lib/legacy-page";
const articleHtml = legacyPageArticle("archive-sunday-services-2018.html");
---
<SiteLayout title="2018 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2018." bodyClass="page-template-default page page-id-390 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2018.html" canonical="/archive-sunday-services-2018.html">
<SiteLayout title="2018 Sunday Service Archive &#8211; FFWPU Ireland" description="Archived FFWPU Ireland Sunday service videos from 2018." bodyClass="page-template-default page page-id-390 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left" pathname="/archive-sunday-services-2018" canonical="/archive-sunday-services-2018">
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -13,4 +13,4 @@ export function getStaticPaths() {
const { year } = Astro.props;
---
<LegacyRedirectPage title={`${year} Sunday Services Archive - FFWPU Ireland`} target={`/archive-sunday-services-${year}.html`} />
<LegacyRedirectPage title={`${year} Sunday Services Archive - FFWPU Ireland`} target={`/archive-sunday-services-${year}`} />

View file

@ -3,6 +3,7 @@ import { getCollection, render } from "astro:content";
import SiteLayout from "../../../../../components/SiteLayout.astro";
import SiteSidebar from "../../../../../components/SiteSidebar.astro";
import { parseBlogSource } from "../../../../../lib/content-routes";
import { stripHtmlExtensionFromInternalUrl } from "../../../../../lib/urls";
const bodyClass =
"post-template-default single single-post single-format-standard custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left";
@ -59,18 +60,18 @@ function descriptionFromHtml(value: string, fallbackTitle: string): string {
function categoryHref(entry, category: string): string {
if (entry.data.type === "speech") {
if (entry.data.speechCollection === "mrs-hak-ja-han-moon" || category.includes("Mrs. Hak Ja Han Moon")) {
return "/speeches/categories/mrs-hak-ja-han-moon.html";
return "/speeches/categories/mrs-hak-ja-han-moon";
}
const year = entry.data.speechYear ?? category.match(/(\d{4})$/)?.[1];
if (year === "1956") {
return "/speeches/categories/rev-sun-myung-moon.html";
return "/speeches/categories/rev-sun-myung-moon";
}
return year ? `/speeches/categories/rev-sun-myung-moon-${year}.html` : "/speeches/categories/rev-sun-myung-moon.html";
return year ? `/speeches/categories/rev-sun-myung-moon-${year}` : "/speeches/categories/rev-sun-myung-moon";
}
return `/blog/categories/${slugify(category)}.html`;
return `/blog/categories/${slugify(category)}`;
}
export async function getStaticPaths() {
@ -114,7 +115,7 @@ const publishedDate = formatDate(entry.data.published);
const updatedDate = formatDate(entry.data.updated);
const categories = entry.data.categories ?? [];
const tags = entry.data.tags ?? [];
const canonical = entry.data.source;
const canonical = stripHtmlExtensionFromInternalUrl(entry.data.source);
const pdfHref = canonical ? `${canonical}?print=pdf` : undefined;
const description = descriptionFromHtml(entry.body ?? "", title);
---
@ -184,7 +185,7 @@ const description = descriptionFromHtml(entry.body ?? "", title);
<span class="bl_posted">Tagged</span>&nbsp;{" "}
{tags.map((tag, index) => (
<>
<a href={`/blog/tags/${slugify(tag)}.html`} rel="tag">{tag}</a>
<a href={`/blog/tags/${slugify(tag)}`} rel="tag">{tag}</a>
{index < tags.length - 1 ? ", " : "."}
</>
))}
@ -204,14 +205,14 @@ const description = descriptionFromHtml(entry.body ?? "", title);
<div id="nav-below" class="navigation">
{previous?.entry.data.source && (
<div class="nav-previous">
<a href={previous.entry.data.source} rel="prev">
<a href={stripHtmlExtensionFromInternalUrl(previous.entry.data.source)} rel="prev">
<span class="meta-nav">&laquo;</span> {previous.entry.data.title ?? "Previous"}
</a>
</div>
)}
{next?.entry.data.source && (
<div class="nav-next">
<a href={next.entry.data.source} rel="next">
<a href={stripHtmlExtensionFromInternalUrl(next.entry.data.source)} rel="next">
{next.entry.data.title ?? "Next"} <span class="meta-nav">&raquo;</span>
</a>
</div>

View file

@ -22,7 +22,6 @@ const { category, entries } = Astro.props;
title={`Category: ${category}`}
heading={`Category: <span>${category}</span>`}
description={`Browse FFWPU Ireland blog posts in the ${category} category.`}
pathname={`/blog/categories/${blogCategorySlug(category)}.html`}
pathname={`/blog/categories/${blogCategorySlug(category)}`}
entries={entries}
/>

View file

@ -9,6 +9,6 @@ const entries = await getArchiveEntries("blog");
title="Blog"
heading="Blog"
description="Browse FFWPU Ireland blog posts, announcements, event notes, and news."
pathname="/blog.html"
pathname="/blog"
entries={entries}
/>

View file

@ -22,7 +22,6 @@ const { tag, entries } = Astro.props;
title={`Tag: ${tag}`}
heading={`Tag: <span>${tag}</span>`}
description={`Browse FFWPU Ireland blog posts tagged ${tag}.`}
pathname={`/blog/tags/${blogTagSlug(tag)}.html`}
pathname={`/blog/tags/${blogTagSlug(tag)}`}
entries={entries}
/>

View file

@ -31,8 +31,8 @@ const contactArticleHtml = articleHtml
title="Contact &#8211; FFWPU Ireland"
description="Contact FFWPU Ireland at Unity House in Dublin city centre or email the community with questions, appointments, and event enquiries."
bodyClass="page-template-default page page-id-63 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/contact.html"
canonical="/contact.html"
pathname="/contact"
canonical="/contact"
>
<TwoColumnPage articleHtml={contactArticleHtml} />
<script is:inline slot="scripts" define:vars={{ contactFormConfig }}>

View file

@ -2,16 +2,19 @@
import SiteLayout from "../components/SiteLayout.astro";
import mainHtml from "../content/pages/events.html?raw";
import { calendarEvents, recurringCalendarEvents } from "../data/events";
import { normalizeInternalHtmlLinks } from "../lib/urls";
const normalizedMainHtml = normalizeInternalHtmlLinks(mainHtml);
---
<SiteLayout
title="Upcoming Events &#8211; FFWPU Ireland"
description="See upcoming FFWPU Ireland community events and calendar listings."
bodyClass="archive post-type-archive post-type-archive-tribe_events custom-background metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/events.html"
canonical="/events.html"
pathname="/events"
canonical="/events"
>
<Fragment set:html={mainHtml} />
<Fragment set:html={normalizedMainHtml} />
<script is:inline slot="scripts" define:vars={{ calendarEvents, recurringCalendarEvents }}>
(() => {
const calendar = document.querySelector("[data-calendar]");
@ -224,7 +227,7 @@ import { calendarEvents, recurringCalendarEvents } from "../data/events";
details.textContent = event.details;
const link = document.createElement("a");
link.href = event.url || "/events.html";
link.href = event.url || "/events";
link.textContent = event.url ? "More details" : "Events";
item.append(date, heading, time, location, details, link);

View file

@ -1,18 +1,21 @@
---
import SiteLayout from "../components/SiteLayout.astro";
import mainHtml from "../content/pages/index.html?raw";
import { normalizeInternalHtmlLinks } from "../lib/urls";
const normalizedMainHtml = normalizeInternalHtmlLinks(mainHtml);
---
<SiteLayout
title="FFWPU Ireland &#8211; Official website of FFWPU Ireland"
description="Official website of FFWPU Ireland, sharing teachings, activities, videos, Sunday services, and resources for families in Ireland."
bodyClass="home blog custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles magazine-layout parabola-menu-left"
pathname="/index.html"
canonical="/index.html"
pathname="/index"
canonical="/index"
parabolaSettings={{ masonry: "1", magazine: "1", mobile: "1", fitvids: "1" }}
>
<script is:inline slot="head" type="text/javascript" src="/assets/theme/parabola/js/nivo-slider.js?ver=2.4.1" id="parabola-nivoSlider-js"></script>
<Fragment set:html={mainHtml} />
<Fragment set:html={normalizedMainHtml} />
<Fragment slot="scripts">
<script is:inline type="text/javascript" src="/assets/vendor/imagesloaded.min.js?ver=5.0.0" id="imagesloaded-js"></script>
<script is:inline type="text/javascript" src="/assets/vendor/masonry.min.js?ver=4.2.2" id="masonry-js"></script>

View file

@ -10,11 +10,10 @@ const articleHtml = legacyPageArticle("register.html");
title="Marriage Blessing Celebration &#8211; FFWPU Ireland"
description="Marriage Blessing Celebration event details and registration information from FFWPU Ireland."
bodyClass="page-template-default page page-id-2522 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/register.html"
canonical="/register.html"
pathname="/register"
canonical="/register"
>
<link slot="head" rel="stylesheet" href="/assets/vendor/forms/public/assets/css/visual-form-builder.min.css?ver=3.0.9" type="text/css" media="all" />
<link slot="head" rel="stylesheet" href="/assets/vendor/forms/public/assets/css/smoothness/jquery-ui-1.10.3.min.css?ver=3.0.9" type="text/css" media="all" />
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -8,8 +8,8 @@ import articleHtml from "../content/pages/services.html?raw";
title="Sunday Services &#8211; FFWPU Ireland"
description="Find FFWPU Ireland Sunday service videos and archived Sunday service messages from the Dublin community."
bodyClass="page-template-default page page-id-33 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/services.html"
canonical="/services.html"
pathname="/services"
canonical="/services"
>
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>

View file

@ -7,7 +7,7 @@ function pageSlug(baseSlug, page) {
}
function pageHref(baseSlug) {
return (page) => `/speeches/categories/${pageSlug(baseSlug, page)}.html`;
return (page) => `/speeches/categories/${pageSlug(baseSlug, page)}`;
}
export async function getStaticPaths() {
@ -45,7 +45,7 @@ const title = `Category: ${category}`;
title={title}
heading={`Category: <span>${category}</span>`}
description={`Browse FFWPU Ireland speeches in ${category}.`}
pathname={`/speeches/categories/${pageSlug(baseSlug, currentPage)}.html`}
pathname={`/speeches/categories/${pageSlug(baseSlug, currentPage)}`}
entries={entries}
currentPage={currentPage}
totalPages={totalPages}

View file

@ -1,6 +1,7 @@
---
import SiteLayout from "../../../components/SiteLayout.astro";
import { excerptFromBody, getArchiveEntries, uniqueSorted } from "../../../lib/archive";
import { stripHtmlExtensionFromInternalUrl } from "../../../lib/urls";
export async function getStaticPaths() {
const entries = await getArchiveEntries("speech");
@ -22,8 +23,8 @@ const { year, entries } = Astro.props;
title={`Speeches by Rev. Dr. Sun Myung Moon ${year} &#8211; FFWPU Ireland`}
description={`Browse FFWPU Ireland speech archive entries from ${year}.`}
bodyClass="page-template-default page custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname={`/speeches/rev-dr-sun-myung-moon/${year}.html`}
canonical={`/speeches/rev-dr-sun-myung-moon/${year}.html`}
pathname={`/speeches/rev-dr-sun-myung-moon/${year}`}
canonical={`/speeches/rev-dr-sun-myung-moon/${year}`}
>
<div id="main">
<div id="forbottom">
@ -38,7 +39,7 @@ const { year, entries } = Astro.props;
{
entries.map((entry) => (
<li>
<a href={entry.data.source}>{entry.data.title ?? "Untitled"}</a>
<a href={stripHtmlExtensionFromInternalUrl(entry.data.source)}>{entry.data.title ?? "Untitled"}</a>
<div class="post-excerpt">{excerptFromBody(entry.body, 150)}</div>
</li>
))
@ -53,4 +54,3 @@ const { year, entries } = Astro.props;
</div>
</div>
</SiteLayout>

View file

@ -8,8 +8,8 @@ import articleHtml from "../content/pages/the-founders.html?raw";
title="The Founders &#8211; FFWPU Ireland"
description="Read about Rev. Sun Myung Moon and Dr. Hak Ja Han Moon, the founders of the Family Federation for World Peace and Unification."
bodyClass="page-template-default page page-id-71 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/the-founders.html"
canonical="/the-founders.html"
pathname="/the-founders"
canonical="/the-founders"
>
<link slot="head" rel="stylesheet" id="su-shortcodes-css" href="/assets/vendor/shortcodes/includes/css/shortcodes.css?ver=7.3.1" type="text/css" media="all" />
<TwoColumnPage articleHtml={articleHtml} />

View file

@ -8,8 +8,8 @@ import articleHtml from "../content/pages/videos.html?raw";
title="Videos &#8211; FFWPU Ireland"
description="Watch FFWPU Ireland videos on faith, family, the Divine Principle, Rev. Sun Myung Moon, and inspirational teaching resources."
bodyClass="page-template-default page page-id-44 custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/videos.html"
canonical="/videos.html"
pathname="/videos"
canonical="/videos"
>
<TwoColumnPage articleHtml={articleHtml} />
</SiteLayout>