diff --git a/.changeset/stale-peas-lay.md b/.changeset/stale-peas-lay.md new file mode 100644 index 000000000..4243f5750 --- /dev/null +++ b/.changeset/stale-peas-lay.md @@ -0,0 +1,6 @@ +--- +'@myst-theme/site': patch +'@myst-theme/book': patch +--- + +Add project.parts.primary_sidebar_footer option diff --git a/.gitignore b/.gitignore index 17213c01f..23db67ffd 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,4 @@ _build # yalc .yalc -yalc.lock +yalc.lock \ No newline at end of file diff --git a/docs/_site/primary_sidebar_footer.md b/docs/_site/primary_sidebar_footer.md new file mode 100644 index 000000000..73b1b844f --- /dev/null +++ b/docs/_site/primary_sidebar_footer.md @@ -0,0 +1 @@ +**Custom Footer** | [GitHub](https://github.com/jupyter-book/myst-theme) diff --git a/docs/myst.yml b/docs/myst.yml index faa42af0e..a6da43f56 100644 --- a/docs/myst.yml +++ b/docs/myst.yml @@ -11,6 +11,7 @@ project: parts: banner: _site/banner.md footer: _site/footer.md + primary_sidebar_footer: _site/primary_sidebar_footer.md toc: - file: index.md - file: examples.md diff --git a/docs/ui.md b/docs/ui.md index 5669df1b1..11aa0eabd 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -42,3 +42,23 @@ project: - Appears at the bottom of every page - Supports any MyST markdown content (links, formatting, etc.) + +## Sidebar Footer + +Display custom content at the bottom of the primary sidebar (table of contents). + +### Configuration + +Create a markdown file with your sidebar footer content and add it to `myst.yml`: + +```yaml +project: + parts: + primary_sidebar_footer: _site/primary_sidebar_footer.md +``` + +### Behavior + +- Appears at the bottom of the primary sidebar (left-side navigation) +- If the `.md` file it points to is empty, the footer will not be visible +- If not configured, falls back to the default "Made with MyST" footer diff --git a/themes/book/app/components/SidebarFooter.tsx b/themes/book/app/components/SidebarFooter.tsx new file mode 100644 index 000000000..995edd849 --- /dev/null +++ b/themes/book/app/components/SidebarFooter.tsx @@ -0,0 +1,15 @@ +import type { GenericParent } from 'myst-common'; +import { MyST } from 'myst-to-react'; +import { MadeWithMyst } from '@myst-theme/icons'; + +export function SidebarFooter({ content }: { content?: GenericParent }) { + if (!content) { + return ; + } + + return ( +
+ +
+ ); +} diff --git a/themes/book/app/routes/$.tsx b/themes/book/app/routes/$.tsx index e81ad1803..e0a20c67c 100644 --- a/themes/book/app/routes/$.tsx +++ b/themes/book/app/routes/$.tsx @@ -31,6 +31,7 @@ import { MadeWithMyst } from '@myst-theme/icons'; import { ArticlePage } from '../components/ArticlePage.js'; import { Footer } from '../components/Footer.js'; import { Banner } from '../components/Banner.js'; +import { SidebarFooter } from '../components/SidebarFooter.js'; import type { TemplateOptions } from '../types.js'; import { useRouteError, isRouteErrorResponse } from '@remix-run/react'; type ManifestProject = Required['projects'][0]; @@ -102,7 +103,7 @@ function ArticlePageAndNavigationInternal({ } + footer={} projectSlug={projectSlug} /> diff --git a/themes/book/template.yml b/themes/book/template.yml index ebfefd20e..ae8fd8f24 100644 --- a/themes/book/template.yml +++ b/themes/book/template.yml @@ -74,6 +74,9 @@ parts: - id: footer description: The site wide footer required: false + - id: primary_sidebar_footer + description: The primary sidebar footer, to replace Made with MyST + required: false build: install: npm install start: npm run start