Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💽 Add site options to each page #472

Merged
merged 1 commit into from
Sep 19, 2024
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
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
Loading