mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
Add pit.world global footer, trim site footer (#246)
Fetch https://pit.world/snippets/footer.html?site=logicsrc.com server-side (1h revalidate, 3s timeout, renders nothing on failure) as the last thing in <body>. Replace the @profullstack/footer block (links row + webring row + copyright) with one row: copyright and the needed links. The network and ring links now come from the global footer. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cc59884c82
commit
c8da4cb4ab
6 changed files with 57 additions and 33 deletions
|
|
@ -92,14 +92,12 @@ describe("server-rendered page markup", () => {
|
||||||
expect(markup).toContain('id="project-request-form"');
|
expect(markup).toContain('id="project-request-form"');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("carries the Profullstack webring links (the ring verifier reads the homepage)", async () => {
|
it("carries the site footer (links + copyright), with no webring of its own", async () => {
|
||||||
process.env.PROFULLSTACK_FOOTER_OFFLINE = "1";
|
|
||||||
const markup = renderPageMarkup("/", await siteFooterHtml());
|
const markup = renderPageMarkup("/", await siteFooterHtml());
|
||||||
expect(markup).toContain("data-pfs-footer");
|
expect(markup).toContain('class="site-footer"');
|
||||||
const from = "from=https%3A%2F%2Flogicsrc.com%2F";
|
expect(markup).toContain('href="/terms"');
|
||||||
for (const hop of ["previous", "next", "random"]) {
|
expect(markup).toContain('href="/privacy"');
|
||||||
expect(markup).toContain(`https://rssamplifier.com/ring/profullstack/${hop}?${from}`);
|
expect(markup).not.toContain("rssamplifier.com/ring");
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@logicsrc/web",
|
"name": "@logicsrc/web",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "LogicSRC standards and open specification PWA (Next.js).",
|
"description": "LogicSRC standards and open specification PWA (Next.js).",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import type { ReactNode } from "react";
|
||||||
import "../styles.css";
|
import "../styles.css";
|
||||||
import Script from "next/script";
|
import Script from "next/script";
|
||||||
import { CopyButtons } from "@/components/copy-buttons";
|
import { CopyButtons } from "@/components/copy-buttons";
|
||||||
|
import { PitFooter } from "@/components/pit-footer";
|
||||||
import { PAGE_META, pageMetadata, SITE_URL } from "@/lib/page-meta";
|
import { PAGE_META, pageMetadata, SITE_URL } from "@/lib/page-meta";
|
||||||
|
|
||||||
const DESCRIPTION = PAGE_META["/"].description;
|
const DESCRIPTION = PAGE_META["/"].description;
|
||||||
|
|
@ -86,6 +87,7 @@ export default function RootLayout({ children }: { children: ReactNode }): React
|
||||||
src="https://crawlproof.com/stats.js"
|
src="https://crawlproof.com/stats.js"
|
||||||
strategy="afterInteractive"
|
strategy="afterInteractive"
|
||||||
/>
|
/>
|
||||||
|
<PitFooter />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
20
apps/logicsrc-web/src/components/pit-footer.tsx
Normal file
20
apps/logicsrc-web/src/components/pit-footer.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
* The pit.world global footer, fetched server-side and cached for an hour.
|
||||||
|
* Renders nothing on any failure so it can never break the page.
|
||||||
|
*/
|
||||||
|
const PIT_FOOTER_URL = "https://pit.world/snippets/footer.html?site=logicsrc.com";
|
||||||
|
|
||||||
|
export async function PitFooter() {
|
||||||
|
try {
|
||||||
|
const res = await fetch(PIT_FOOTER_URL, {
|
||||||
|
next: { revalidate: 3600 },
|
||||||
|
signal: AbortSignal.timeout(3000),
|
||||||
|
});
|
||||||
|
if (!res.ok) return null;
|
||||||
|
const html = await res.text();
|
||||||
|
if (!html.includes("data-pit-footer")) return null;
|
||||||
|
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,7 @@ import type { ReactNode } from "react";
|
||||||
import { renderInstallCommand } from "@/lib/install-command";
|
import { renderInstallCommand } from "@/lib/install-command";
|
||||||
import { Breadcrumbs } from "@/components/breadcrumbs";
|
import { Breadcrumbs } from "@/components/breadcrumbs";
|
||||||
import { SideNav } from "@/components/side-nav";
|
import { SideNav } from "@/components/side-nav";
|
||||||
import { Footer } from "@profullstack/footer/react";
|
import { SITE_FOOTER_COLOR, SITE_FOOTER_HTML } from "@/lib/site-footer";
|
||||||
import { SITE_FOOTER, SITE_FOOTER_COLOR } from "@/lib/site-footer";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The site chrome for every standalone route: the sidebar that unfolds to
|
* The site chrome for every standalone route: the sidebar that unfolds to
|
||||||
|
|
@ -39,9 +38,10 @@ export function SiteShell({
|
||||||
<section className="workspace">
|
<section className="workspace">
|
||||||
<Breadcrumbs leaf={crumbTitle} />
|
<Breadcrumbs leaf={crumbTitle} />
|
||||||
{children}
|
{children}
|
||||||
<div style={{ color: SITE_FOOTER_COLOR, marginTop: "2rem" }}>
|
<div
|
||||||
<Footer {...SITE_FOOTER} />
|
style={{ color: SITE_FOOTER_COLOR, marginTop: "2rem" }}
|
||||||
</div>
|
dangerouslySetInnerHTML={{ __html: SITE_FOOTER_HTML }}
|
||||||
|
/>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,30 @@
|
||||||
import { footerHtml, type FooterOptions } from "@profullstack/footer";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The site footer: @profullstack/footer (links, copyright and the Profullstack
|
* The site footer: one row of links plus the copyright. The network links
|
||||||
* webring). SiteShell renders it as the package's React server component; the
|
* (pit.world, search, ring) come from the pit.world global footer, which the
|
||||||
* homepage, which is the legacy markup string (lib/page-markup.ts), gets the same
|
* root layout appends to every page (components/pit-footer.tsx).
|
||||||
* footer as HTML. Both render on the server, which is what the ring's verifier reads.
|
* SiteShell and the homepage markup string (lib/page-markup.ts) share this HTML.
|
||||||
*/
|
*/
|
||||||
export const SITE_FOOTER: FooterOptions = {
|
const LINKS: Array<[string, string]> = [
|
||||||
site: "https://logicsrc.com/",
|
["Specs", "/specs"],
|
||||||
links: [
|
["Docs", "/docs"],
|
||||||
{ label: "Specs", href: "/specs" },
|
["Blog", "/blog"],
|
||||||
{ label: "Docs", href: "/docs" },
|
["RSS", "/blog/rss.xml"],
|
||||||
{ label: "RSS", href: "/blog/rss.xml" },
|
["llms.txt", "/llms.txt"],
|
||||||
{ label: "llms.txt", href: "/llms.txt" },
|
["Code", "https://github.com/profullstack/logicsrc"],
|
||||||
{ label: "Terms", href: "/terms" },
|
["Terms", "/terms"],
|
||||||
{ label: "Privacy", href: "/privacy" },
|
["Privacy", "/privacy"],
|
||||||
],
|
];
|
||||||
};
|
|
||||||
|
|
||||||
/** Muted text, as the old footer had; the package inherits `color`. */
|
/** Muted text, as the old footer had. */
|
||||||
export const SITE_FOOTER_COLOR = "#5b6b7a";
|
export const SITE_FOOTER_COLOR = "#5b6b7a";
|
||||||
|
|
||||||
export function siteFooterHtml(): Promise<string> {
|
export const SITE_FOOTER_HTML =
|
||||||
return footerHtml(SITE_FOOTER);
|
`<footer class="site-footer" style="display:flex;flex-wrap:wrap;justify-content:space-between;gap:.5rem 1.25rem;border-top:1px solid rgba(91,107,122,.25);padding:1.25rem 0;font-size:.875rem">` +
|
||||||
|
`<span>© ${new Date().getFullYear()} LogicSRC</span>` +
|
||||||
|
`<nav aria-label="Footer" style="display:flex;flex-wrap:wrap;gap:.5rem 1.25rem">` +
|
||||||
|
LINKS.map(([label, href]) => `<a href="${href}" style="color:inherit">${label}</a>`).join("") +
|
||||||
|
`</nav></footer>`;
|
||||||
|
|
||||||
|
export async function siteFooterHtml(): Promise<string> {
|
||||||
|
return SITE_FOOTER_HTML;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue