mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-11-29 15:51:52 +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"');
|
||||
});
|
||||
|
||||
it("carries the Profullstack webring links (the ring verifier reads the homepage)", async () => {
|
||||
process.env.PROFULLSTACK_FOOTER_OFFLINE = "1";
|
||||
it("carries the site footer (links + copyright), with no webring of its own", async () => {
|
||||
const markup = renderPageMarkup("/", await siteFooterHtml());
|
||||
expect(markup).toContain("data-pfs-footer");
|
||||
const from = "from=https%3A%2F%2Flogicsrc.com%2F";
|
||||
for (const hop of ["previous", "next", "random"]) {
|
||||
expect(markup).toContain(`https://rssamplifier.com/ring/profullstack/${hop}?${from}`);
|
||||
}
|
||||
expect(markup).toContain('class="site-footer"');
|
||||
expect(markup).toContain('href="/terms"');
|
||||
expect(markup).toContain('href="/privacy"');
|
||||
expect(markup).not.toContain("rssamplifier.com/ring");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@logicsrc/web",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"private": true,
|
||||
"description": "LogicSRC standards and open specification PWA (Next.js).",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import type { ReactNode } from "react";
|
|||
import "../styles.css";
|
||||
import Script from "next/script";
|
||||
import { CopyButtons } from "@/components/copy-buttons";
|
||||
import { PitFooter } from "@/components/pit-footer";
|
||||
import { PAGE_META, pageMetadata, SITE_URL } from "@/lib/page-meta";
|
||||
|
||||
const DESCRIPTION = PAGE_META["/"].description;
|
||||
|
|
@ -86,6 +87,7 @@ export default function RootLayout({ children }: { children: ReactNode }): React
|
|||
src="https://crawlproof.com/stats.js"
|
||||
strategy="afterInteractive"
|
||||
/>
|
||||
<PitFooter />
|
||||
</body>
|
||||
</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 { Breadcrumbs } from "@/components/breadcrumbs";
|
||||
import { SideNav } from "@/components/side-nav";
|
||||
import { Footer } from "@profullstack/footer/react";
|
||||
import { SITE_FOOTER, SITE_FOOTER_COLOR } from "@/lib/site-footer";
|
||||
import { SITE_FOOTER_COLOR, SITE_FOOTER_HTML } from "@/lib/site-footer";
|
||||
|
||||
/**
|
||||
* The site chrome for every standalone route: the sidebar that unfolds to
|
||||
|
|
@ -39,9 +38,10 @@ export function SiteShell({
|
|||
<section className="workspace">
|
||||
<Breadcrumbs leaf={crumbTitle} />
|
||||
{children}
|
||||
<div style={{ color: SITE_FOOTER_COLOR, marginTop: "2rem" }}>
|
||||
<Footer {...SITE_FOOTER} />
|
||||
</div>
|
||||
<div
|
||||
style={{ color: SITE_FOOTER_COLOR, marginTop: "2rem" }}
|
||||
dangerouslySetInnerHTML={{ __html: SITE_FOOTER_HTML }}
|
||||
/>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,26 +1,30 @@
|
|||
import { footerHtml, type FooterOptions } from "@profullstack/footer";
|
||||
|
||||
/**
|
||||
* The site footer: @profullstack/footer (links, copyright and the Profullstack
|
||||
* webring). SiteShell renders it as the package's React server component; the
|
||||
* homepage, which is the legacy markup string (lib/page-markup.ts), gets the same
|
||||
* footer as HTML. Both render on the server, which is what the ring's verifier reads.
|
||||
* The site footer: one row of links plus the copyright. The network links
|
||||
* (pit.world, search, ring) come from the pit.world global footer, which the
|
||||
* root layout appends to every page (components/pit-footer.tsx).
|
||||
* SiteShell and the homepage markup string (lib/page-markup.ts) share this HTML.
|
||||
*/
|
||||
export const SITE_FOOTER: FooterOptions = {
|
||||
site: "https://logicsrc.com/",
|
||||
links: [
|
||||
{ label: "Specs", href: "/specs" },
|
||||
{ label: "Docs", href: "/docs" },
|
||||
{ label: "RSS", href: "/blog/rss.xml" },
|
||||
{ label: "llms.txt", href: "/llms.txt" },
|
||||
{ label: "Terms", href: "/terms" },
|
||||
{ label: "Privacy", href: "/privacy" },
|
||||
],
|
||||
};
|
||||
const LINKS: Array<[string, string]> = [
|
||||
["Specs", "/specs"],
|
||||
["Docs", "/docs"],
|
||||
["Blog", "/blog"],
|
||||
["RSS", "/blog/rss.xml"],
|
||||
["llms.txt", "/llms.txt"],
|
||||
["Code", "https://github.com/profullstack/logicsrc"],
|
||||
["Terms", "/terms"],
|
||||
["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 function siteFooterHtml(): Promise<string> {
|
||||
return footerHtml(SITE_FOOTER);
|
||||
export const SITE_FOOTER_HTML =
|
||||
`<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