feat: add Markdown cut link to footer and page for improved accessibility

This commit is contained in:
Dries Augustyns
2026-05-12 08:07:57 +02:00
parent 649bbf6d6b
commit ccd516e4e8
2 changed files with 20 additions and 1 deletions
+13 -1
View File
@@ -1,5 +1,6 @@
import Image from 'next/image'; import Image from 'next/image';
import Link from 'next/link'; import Link from 'next/link';
import {useRouter} from 'next/router';
import {WIKI_URI} from '../../lib/constants'; import {WIKI_URI} from '../../lib/constants';
import logo from '../../../public/assets/logo.svg'; import logo from '../../../public/assets/logo.svg';
@@ -7,6 +8,10 @@ import logo from '../../../public/assets/logo.svg';
* *
*/ */
export default function Footer() { export default function Footer() {
const router = useRouter();
const path = (router.asPath || '/').split(/[?#]/)[0];
const trimmed = path === '/' ? '/' : path.replace(/\/$/, '');
const mdHref = `${trimmed}.md`;
return ( return (
<> <>
<footer className={'border-t border-neutral-200 bg-white'}> <footer className={'border-t border-neutral-200 bg-white'}>
@@ -263,8 +268,15 @@ export default function Footer() {
</div> </div>
</div> </div>
<div className="mt-16 border-t border-neutral-200 pt-8"> <div className="mt-16 flex flex-col gap-2 border-t border-neutral-200 pt-8 sm:flex-row sm:items-center sm:justify-between">
<p className="text-sm text-neutral-500">&copy; {new Date().getFullYear()} Plunk. All rights reserved.</p> <p className="text-sm text-neutral-500">&copy; {new Date().getFullYear()} Plunk. All rights reserved.</p>
<p style={{fontFamily: 'var(--font-mono)'}} className="text-[11px] text-neutral-400">
Reading this with electronic eyes? Append{' '}
<a href={mdHref} className="text-neutral-500 underline decoration-dotted underline-offset-2 transition hover:text-neutral-900">
<code>.md</code>
</a>{' '}
to any URL for the Markdown cut.
</p>
</div> </div>
</div> </div>
</footer> </footer>
+7
View File
@@ -26,6 +26,13 @@ export default async function Page(props: {params: Promise<{slug?: string[]}>})
markdownUrl={`/llms.mdx${page.url}`} markdownUrl={`/llms.mdx${page.url}`}
githubUrl={`https://github.com/useplunk/plunk/blob/next/apps/wiki/content/docs/${page.path}`} githubUrl={`https://github.com/useplunk/plunk/blob/next/apps/wiki/content/docs/${page.path}`}
/> />
<p className="ml-auto hidden text-[11px] text-fd-muted-foreground sm:block">
Reading this with electronic eyes? Add{' '}
<a href={`${page.url}.md`} className="underline decoration-dotted underline-offset-2 transition hover:text-fd-foreground">
<code>.md</code>
</a>{' '}
for the Markdown cut.
</p>
</div> </div>
<DocsBody> <DocsBody>