Skip to content

Commit

Permalink
💽 Add site options to each page (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 authored Sep 19, 2024
1 parent 2cb619f commit 06d5fb3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .changeset/tame-tips-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@myst-theme/article': patch
'@myst-theme/book': patch
---

Per page options for the site
9 changes: 2 additions & 7 deletions themes/article/app/components/ArticlePage.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down Expand Up @@ -112,4 +108,3 @@ export function ArticlePage({ article }: { article: PageLoader }) {
</ReferencesProvider>
);
}

2 changes: 1 addition & 1 deletion themes/book/app/components/ArticlePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 } = {
Expand Down
2 changes: 1 addition & 1 deletion themes/book/app/routes/$.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 } = {
Expand Down

0 comments on commit 06d5fb3

Please sign in to comment.