parent
8e40b8599b
commit
830585e2ba
15 changed files with 5371 additions and 15 deletions
18
src/components/SiteFooter.astro
Normal file
18
src/components/SiteFooter.astro
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<footer id="footer" role="contentinfo">
|
||||
<div id="colophon"></div>
|
||||
|
||||
<div id="footer2">
|
||||
<div id="footer2-inner">
|
||||
<div id="site-copyright">
|
||||
<b>Family Federation for World Peace and Unification (FFWPU) Ireland</b>
|
||||
<br />
|
||||
Charity no. CHY 6071 All Rights Reserved 2013
|
||||
<br />
|
||||
<a href="/speeches/" target="_blank">Speeches</a>
|
||||
</div>
|
||||
<div style="text-align:center;padding:5px 0 2px;text-transform:uppercase;font-size:12px;margin:1em auto 0;">
|
||||
Family Federation for World Peace and Unification Ireland
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
70
src/components/SiteNav.astro
Normal file
70
src/components/SiteNav.astro
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
const { pathname = "/" } = Astro.props;
|
||||
|
||||
const navItems = [
|
||||
{ href: "/index.html", label: "Home", match: ["/index.html", "/"] },
|
||||
{
|
||||
href: "/about.html",
|
||||
label: "About Us",
|
||||
match: ["/about.html", "/the-founders.html", "/about-us-organizations.html"],
|
||||
children: [
|
||||
{ href: "/the-founders.html", label: "The Founders" },
|
||||
{ href: "/about-us-organizations.html", label: "Organizations" },
|
||||
],
|
||||
},
|
||||
{ href: "/videos.html", label: "Videos", match: ["/videos.html"] },
|
||||
{
|
||||
href: "/events.html",
|
||||
label: "Events",
|
||||
match: ["/events.html", "/services.html"],
|
||||
children: [{ href: "/services.html", label: "Sunday Services" }],
|
||||
},
|
||||
{ href: "/speeches/", label: "Speeches", match: ["/speeches/"] },
|
||||
{ href: "/contact.html", label: "Contact", match: ["/contact.html"] },
|
||||
];
|
||||
|
||||
function isCurrent(item) {
|
||||
return item.match.some((match) => {
|
||||
if (match === "/") {
|
||||
return pathname === "/";
|
||||
}
|
||||
if (match.endsWith("/")) {
|
||||
return pathname.startsWith(match);
|
||||
}
|
||||
return pathname === match;
|
||||
});
|
||||
}
|
||||
---
|
||||
|
||||
<nav id="access" class="jssafe" role="navigation">
|
||||
<div class="skip-link screen-reader-text"><a href="#content" title="Skip to content">Skip to content</a></div>
|
||||
<div class="menu">
|
||||
<ul id="prime_nav" class="menu">
|
||||
{
|
||||
navItems.map((item, index) => {
|
||||
const current = isCurrent(item);
|
||||
return (
|
||||
<li class:list={["menu-item", item.children && "menu-item-has-children", current && "current-menu-item current_page_item", `menu-item-${index + 1}`]}>
|
||||
<a href={item.href} aria-current={current ? "page" : undefined}>
|
||||
<span>{item.label}</span>
|
||||
</a>
|
||||
{
|
||||
item.children && (
|
||||
<ul class="sub-menu">
|
||||
{item.children.map((child, childIndex) => (
|
||||
<li class={`menu-item menu-item-${index + 1}-${childIndex + 1}`}>
|
||||
<a href={child.href}>
|
||||
<span>{child.label}</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
</li>
|
||||
);
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
26
src/components/SiteSidebar.astro
Normal file
26
src/components/SiteSidebar.astro
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
const sidebarItems = [
|
||||
{ href: "/the-founders.html", label: "The Founders" },
|
||||
{ href: "/services.html", label: "Sunday Services" },
|
||||
{ href: "/contact.html", label: "Contact" },
|
||||
{ href: "/speeches/", label: "Speeches" },
|
||||
];
|
||||
---
|
||||
|
||||
<div id="secondary" class="widget-area sidey" role="complementary">
|
||||
<ul class="xoxo">
|
||||
<li id="nav_menu-2" class="widget-container widget_nav_menu">
|
||||
<div class="menu-menu-3-side-bar-menu-container">
|
||||
<ul id="menu-menu-3-side-bar-menu" class="menu">
|
||||
{
|
||||
sidebarItems.map((item, index) => (
|
||||
<li class={`menu-item menu-item-${index + 1}`}>
|
||||
<a href={item.href}>{item.label}</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
32
src/lib/static-pages.ts
Normal file
32
src/lib/static-pages.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
export const repoRoot = process.cwd();
|
||||
export const websiteRoot = path.join(repoRoot, "website");
|
||||
|
||||
export function walkHtmlFiles(dir = websiteRoot): string[] {
|
||||
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
return walkHtmlFiles(fullPath);
|
||||
}
|
||||
return entry.isFile() && entry.name.endsWith(".html") ? [fullPath] : [];
|
||||
});
|
||||
}
|
||||
|
||||
export function relativeWebsitePath(filePath: string): string {
|
||||
return path.relative(websiteRoot, filePath).split(path.sep).join("/");
|
||||
}
|
||||
|
||||
export function routeFromRelativePath(relativePath: string): string {
|
||||
if (relativePath === "index.html") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
export function sourcePathFromRoute(route = ""): string {
|
||||
const relativePath = route === "" ? "index.html" : route.endsWith(".html") ? route : `${route}/index.html`;
|
||||
return path.join(websiteRoot, relativePath);
|
||||
}
|
||||
23
src/pages/[...route].ts
Normal file
23
src/pages/[...route].ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import fs from "node:fs/promises";
|
||||
import { relativeWebsitePath, routeFromRelativePath, sourcePathFromRoute, walkHtmlFiles } from "../lib/static-pages";
|
||||
|
||||
export function getStaticPaths() {
|
||||
return walkHtmlFiles()
|
||||
.map(relativeWebsitePath)
|
||||
.filter((relativePath) => relativePath !== "index.html")
|
||||
.map((relativePath) => ({
|
||||
params: {
|
||||
route: routeFromRelativePath(relativePath),
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
export async function GET({ params }: { params: { route?: string } }) {
|
||||
const html = await fs.readFile(sourcePathFromRoute(params.route), "utf8");
|
||||
|
||||
return new Response(html, {
|
||||
headers: {
|
||||
"content-type": "text/html; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
12
src/pages/index.html.ts
Normal file
12
src/pages/index.html.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import fs from "node:fs/promises";
|
||||
import { sourcePathFromRoute } from "../lib/static-pages";
|
||||
|
||||
export async function GET() {
|
||||
const html = await fs.readFile(sourcePathFromRoute(), "utf8");
|
||||
|
||||
return new Response(html, {
|
||||
headers: {
|
||||
"content-type": "text/html; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue