From d39ac92e58e27a9cb4aea69ef205399fa21233e4 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Sat, 14 Sep 2024 17:03:59 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=BD=20Add=20site=20options=20to=20each?= =?UTF-8?q?=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/tame-tips-rush.md | 6 ++++++ themes/article/app/components/ArticlePage.tsx | 9 ++------- themes/book/app/components/ArticlePage.tsx | 2 +- themes/book/app/routes/$.tsx | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 .changeset/tame-tips-rush.md diff --git a/.changeset/tame-tips-rush.md b/.changeset/tame-tips-rush.md new file mode 100644 index 000000000..5421bc29b --- /dev/null +++ b/.changeset/tame-tips-rush.md @@ -0,0 +1,6 @@ +--- +'@myst-theme/article': patch +'@myst-theme/book': patch +--- + +Per page options for the site diff --git a/themes/article/app/components/ArticlePage.tsx b/themes/article/app/components/ArticlePage.tsx index cb1ceab68..f9899e19a 100644 --- a/themes/article/app/components/ArticlePage.tsx +++ b/themes/article/app/components/ArticlePage.tsx @@ -1,9 +1,5 @@ import type { PageLoader } from '@myst-theme/common'; -import { - FooterLinksBlock, - ArticleHeader, - Error404, -} from '@myst-theme/site'; +import { FooterLinksBlock, ArticleHeader, Error404 } from '@myst-theme/site'; import { LaunchBinder, useComputeOptions } from '@myst-theme/jupyter'; import { ArrowLeftIcon } from '@heroicons/react/24/outline'; import { DocumentArrowDownIcon } from '@heroicons/react/24/outline'; @@ -25,7 +21,7 @@ export function ArticlePage({ article }: { article: PageLoader }) { const grid = useGridSystemProvider(); const siteManifest = useSiteManifest() as SiteManifest; - const pageDesign: TemplateOptions = (article.frontmatter as any)?.options ?? {}; + const pageDesign: TemplateOptions = (article.frontmatter as any)?.site ?? {}; const siteDesign: TemplateOptions = siteManifest?.options ?? {}; const { projects } = siteManifest; @@ -112,4 +108,3 @@ export function ArticlePage({ article }: { article: PageLoader }) { ); } - diff --git a/themes/book/app/components/ArticlePage.tsx b/themes/book/app/components/ArticlePage.tsx index 4438ff782..b50a303ce 100644 --- a/themes/book/app/components/ArticlePage.tsx +++ b/themes/book/app/components/ArticlePage.tsx @@ -64,7 +64,7 @@ export const ArticlePage = React.memo(function ({ const compute = useComputeOptions(); const top = useThemeTop(); - const pageDesign: TemplateOptions = (article.frontmatter as any)?.options ?? {}; + const pageDesign: TemplateOptions = (article.frontmatter as any)?.site ?? {}; const siteDesign: TemplateOptions = (useSiteManifest() as SiteManifest & TemplateOptions)?.options ?? {}; const { hide_title_block, hide_footer_links, hide_outline, outline_maxdepth } = { diff --git a/themes/book/app/routes/$.tsx b/themes/book/app/routes/$.tsx index adab7dfa8..be0b804e0 100644 --- a/themes/book/app/routes/$.tsx +++ b/themes/book/app/routes/$.tsx @@ -136,7 +136,7 @@ export default function Page() { const { container } = useOutlineHeight(); const data = useLoaderData() as { page: PageLoader; project: ManifestProject }; const baseurl = useBaseurl(); - const pageDesign: TemplateOptions = (data.page.frontmatter as any)?.options ?? {}; + const pageDesign: TemplateOptions = (data.page.frontmatter as any)?.site ?? {}; const siteDesign: TemplateOptions = (useSiteManifest() as SiteManifest & TemplateOptions)?.options ?? {}; const { hide_toc, hide_footer_links } = {