Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ The template docs are built with [Starlight](https://starlight.astro.build). Eac

Page titles are written for search, so `src/routeData.ts` turns "Work with the database" into "Work with the database | Clean Minimal API for .NET" in the browser tab, and leaves the heading alone. `src/data/structured-data.ts` adds the JSON-LD that tells search engines and LLMs what each template is. Give every page a short, plain title and a description and they do the rest.

`src/components/docs/TwoColumnContent.astro` is a copy of Starlight's own, changed so the organisation footer (`OrgFooter.astro`) sits after `<main>` and screen readers list it as the page footer. When you upgrade Starlight, diff it against `node_modules/@astrojs/starlight/dist/components/TwoColumnContent.astro` and carry over anything new.

To add a page, drop a Markdown or MDX file in the template's folder and add it to that template's sidebar. `npm run build` checks every internal link and heading anchor across the docs and fails if one is broken.

The build also writes the docs out for LLMs: `llms.txt` lists the templates and their key pages, `llms-full.txt` and `llms-small.txt` hold everything, and `_llms-txt/` has one file per template and one for the brand, so a model asked about one template only has to read that one. A new template's file appears once it's in `src/data/templates.ts`.
Expand Down
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default defineConfig({
Hero: './src/components/docs/Hero.astro',
ThemeSelect: './src/components/docs/ThemeSelect.astro',
Sidebar: './src/components/docs/Sidebar.astro',
Footer: './src/components/docs/Footer.astro',
TwoColumnContent: './src/components/docs/TwoColumnContent.astro',
},
plugins: [
starlightSidebarTopics(
Expand Down
68 changes: 0 additions & 68 deletions src/components/docs/Footer.astro

This file was deleted.

83 changes: 83 additions & 0 deletions src/components/docs/OrgFooter.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
// The organisation footer under every docs page. TwoColumnContent renders it after <main>, so it's the
// page's footer landmark ("content information" to a screen reader) and not part of the article.
// Starlight's own footer (Edit page, Last updated, Previous and Next) stays inside <main>, because it
// belongs to the page.
const community = 'https://github.com/LeanMeanCleanApps/.github/blob/main';
---

<div class="cl-footer-panel">
<footer class="cl-footer">
<a class="cl-org" href="/">
<img src="/logos/org-spectrum-small-tile.svg" alt="Lean Mean Clean Apps logo" aria-hidden="true" width="28" height="28" />
<span>Part of <b>Lean Mean Clean Apps</b></span>
</a>
<nav aria-label="Lean Mean Clean Apps">
<a href={`${community}/SUPPORT.md`}>Support</a>
<a href={`${community}/SECURITY.md`}>Security</a>
<a href={`${community}/CONTRIBUTING.md`}>Contributing</a>
<a href="/accessibility/">Accessibility</a>
<a href="/brand/">Brand</a>
<a href="https://github.com/sponsors/stphnwlsh">Sponsor</a>
</nav>
<p>
Made by the <a href="/">Lean Mean Clean Apps</a> team with strong coffee and a healthy disregard for pomp and
ceremony. Not affiliated with Uncle Bob, a certain billionaire's chest piece, or anyone with a marketing budget.
</p>
</footer>
</div>

<style>
/* Lines up with Starlight's content panel above it, and takes over <main>'s 3vh bottom padding
(see TwoColumnContent.astro). */
.cl-footer-panel {
padding: 0.5rem var(--sl-content-pad-x) calc(1.5rem + 3vh);
}

.cl-footer {
max-width: var(--sl-content-width);
display: grid;
justify-items: center;
gap: 0.75rem;
padding-top: 1.25rem;
border-top: 1px dashed var(--sl-color-gray-5);
color: var(--sl-color-gray-3);
font-size: var(--sl-text-xs);
text-align: center;
}

.cl-footer a {
color: inherit;
}

.cl-org {
display: inline-flex;
align-items: center;
gap: 0.5rem;
text-decoration: none;
font-size: var(--sl-text-sm);
}

.cl-org b {
font-family: var(--lmca-font-display);
color: var(--sl-color-white);
}

.cl-footer nav {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.4rem 1rem;
}

.cl-footer p {
margin: 0;
max-width: 40rem;
}

@media (min-width: 72rem) {
.cl-footer {
margin-inline: var(--sl-content-margin-inline, auto);
}
}
</style>
79 changes: 79 additions & 0 deletions src/components/docs/TwoColumnContent.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
// Starlight's TwoColumnContent from @astrojs/starlight 0.42.8, with one change: the organisation footer
// renders after <main> instead of inside it, so it's the page's footer landmark. Starlight doesn't let
// us override Page.astro, where <main> lives, and this is the closest component that wraps it.
// When Starlight is upgraded, diff this against node_modules/@astrojs/starlight/dist/components/TwoColumnContent.astro.
import OrgFooter from './OrgFooter.astro';
---

<div class="lg:sl-flex">
{
Astro.locals.starlightRoute.toc && (
<aside class="right-sidebar-container print:hidden">
<div class="right-sidebar">
<slot name="right-sidebar" />
</div>
</aside>
)
}
<div class="main-pane">
<slot />
<OrgFooter />
</div>
</div>

<style>
/* Ours, not Starlight's: the organisation footer ends the page now, so it takes the bottom padding
Starlight gives <main> (3vh), and the spacing looks the same as before. */
.main-pane {
--sl-main-pad: 0;
}

@layer starlight.core {
.main-pane {
isolation: isolate;
}

@media (min-width: 72rem) {
.right-sidebar-container {
order: 2;
position: relative;
/* Keep the sidebar at the end of the row if it paints before the main pane is parsed. */
margin-inline-start: auto;
width: max(
var(--sl-sidebar-width),
calc(
var(--sl-sidebar-width) + (100% - var(--sl-content-width) - var(--sl-sidebar-width)) / 2
)
);
}

.right-sidebar {
position: fixed;
top: 0;
border-inline-start: 1px solid var(--sl-color-hairline);
padding-top: var(--sl-nav-height);
width: 100%;
height: 100vh;
overflow-y: auto;
scrollbar-width: none;
}

.main-pane {
width: 100%;
}

:global([data-has-sidebar][data-has-toc]) .main-pane {
--sl-content-margin-inline: auto 0;

order: 1;
width: min(
calc(100% - var(--sl-sidebar-width)),
calc(
var(--sl-content-width) + (100% - var(--sl-content-width) - var(--sl-sidebar-width)) / 2
)
);
}
}
}
</style>