Skip to content

Commit

Permalink
πŸ‘©β€πŸŽ¨ Get design fields directly from options (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch authored and rowanc1 committed Nov 14, 2023
1 parent 43376ef commit 14773e4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changeset/stupid-socks-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@myst-theme/article': patch
'@myst-theme/site': patch
'@myst-theme/book': patch
---

Get design fields from options
2 changes: 1 addition & 1 deletion packages/site/src/pages/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const ArticlePage = React.memo(function ({
}) {
const canCompute = useCanCompute();

const { hide_title_block, hide_footer_links } = (article.frontmatter as any)?.design ?? {};
const { hide_title_block, hide_footer_links } = (article.frontmatter as any)?.options ?? {};

const tree = copyNode(article.mdast);
const keywords = article.frontmatter?.keywords ?? [];
Expand Down
2 changes: 1 addition & 1 deletion themes/article/app/routes/$.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export function ArticlePage({ article }: { article: PageLoader }) {
export default function Page() {
// const { container, outline } = useOutlineHeight();
const article = useLoaderData<PageLoader>() as PageLoader;
const { hide_outline } = (article.frontmatter as any)?.design ?? {};
const { hide_outline } = (article.frontmatter as any)?.options ?? {};

return (
<ArticlePageAndNavigation>
Expand Down
4 changes: 2 additions & 2 deletions themes/book/app/routes/$.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export default function Page() {
const { container, outline } = useOutlineHeight();
const top = useThemeTop();
const article = useLoaderData<PageLoader>() as PageLoader;
const pageDesign: BookThemeTemplateOptions = (article.frontmatter as any)?.design ?? {};
const pageDesign: BookThemeTemplateOptions = (article.frontmatter as any)?.options ?? {};
const siteDesign: BookThemeTemplateOptions =
(useSiteManifest() as SiteManifest & BookThemeTemplateOptions) ?? {};
(useSiteManifest() as SiteManifest & BookThemeTemplateOptions)?.options ?? {};
const { hide_toc, hide_outline, hide_footer_links } = { ...siteDesign, ...pageDesign };
return (
<ArticlePageAndNavigation hide_toc={hide_toc} projectSlug={article.project}>
Expand Down

0 comments on commit 14773e4

Please sign in to comment.