From 9f0312fa399258c73d1daa29e14948a5e6dc46a5 Mon Sep 17 00:00:00 2001 From: Franklin Koch Date: Tue, 14 Nov 2023 10:24:57 -0700 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=A7=B1=20Respect=20visibility:=20remo?= =?UTF-8?q?ve=20on=20blocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/clean-ears-allow.md | 5 +++++ packages/site/src/components/ContentBlocks.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/clean-ears-allow.md diff --git a/.changeset/clean-ears-allow.md b/.changeset/clean-ears-allow.md new file mode 100644 index 000000000..8f2cd4c71 --- /dev/null +++ b/.changeset/clean-ears-allow.md @@ -0,0 +1,5 @@ +--- +'@myst-theme/site': patch +--- + +Respect visibility: remove on blocks diff --git a/packages/site/src/components/ContentBlocks.tsx b/packages/site/src/components/ContentBlocks.tsx index 10fb28d87..32477d4ea 100644 --- a/packages/site/src/components/ContentBlocks.tsx +++ b/packages/site/src/components/ContentBlocks.tsx @@ -78,7 +78,7 @@ export function ContentBlocks({ const blocks = mdast.children as GenericParent[]; return ( <> - {blocks.map((node) => ( + {blocks.filter((node) => node.visibility !== 'remove').map((node) => ( ))} From 237bd7453e7cfcabd3a4f8cc7fbbc56ccb4ed2df Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Tue, 14 Nov 2023 10:24:57 -0700 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8C=86=20Move=20logo=20into=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/src/utils.ts | 22 +++++++++++++++++-- .../site/src/components/ContentBlocks.tsx | 14 +++++++++--- .../site/src/components/Navigation/TopNav.tsx | 11 +++------- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index 3f881dedb..da006eef1 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -97,8 +97,26 @@ export function updateSiteManifestStaticLinksInplace( action.url = updateUrl(action.url); }); // TODO: this needs to be based on the template.yml in the future - if (data.logo) data.logo = updateUrl(data.logo); - if (data.logo_dark) data.logo_dark = updateUrl(data.logo_dark); + // We have moved logo/logo_dark to options in v1.1.28 + data.options ??= {}; + if (data.logo) { + data.options.logo = data.logo; + delete data.logo; + } + if (data.logo_dark) { + data.options.logo_dark = data.logo_dark; + delete data.logo_dark; + } + if (data.logoText) { + data.options.logo_text = data.logoText; + delete data.logoText; + } + if (data.logo_text) { + data.options.logo_text = data.logo_text; + delete data.logo_text; + } + if (data.options.logo) data.options.logo = updateUrl(data.options.logo); + if (data.options.logo_dark) data.options.logo_dark = updateUrl(data.options.logo_dark); // Update the thumbnails to point at the CDN data.projects?.forEach((project) => { if (project.banner) project.banner = updateUrl(project.banner); diff --git a/packages/site/src/components/ContentBlocks.tsx b/packages/site/src/components/ContentBlocks.tsx index 32477d4ea..22795a178 100644 --- a/packages/site/src/components/ContentBlocks.tsx +++ b/packages/site/src/components/ContentBlocks.tsx @@ -78,9 +78,17 @@ export function ContentBlocks({ const blocks = mdast.children as GenericParent[]; return ( <> - {blocks.filter((node) => node.visibility !== 'remove').map((node) => ( - - ))} + {blocks + .filter((node) => node.visibility !== 'remove') + .map((node) => ( + + ))} ); } diff --git a/packages/site/src/components/Navigation/TopNav.tsx b/packages/site/src/components/Navigation/TopNav.tsx index 939ca35f5..8e235ff03 100644 --- a/packages/site/src/components/Navigation/TopNav.tsx +++ b/packages/site/src/components/Navigation/TopNav.tsx @@ -244,8 +244,8 @@ function HomeLink({ export function TopNav() { const [open, setOpen] = useNavOpen(); const config = useSiteManifest(); - const { logo, logo_dark, logo_text, logoText, actions, title, nav } = - config ?? ({} as SiteManifest); + const { title, nav, actions } = config ?? {}; + const { logo, logo_dark, logo_text } = config?.options ?? {}; return (
- +
From 43376ef75a0454510e45efece464a3d416fd5ea4 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Tue, 14 Nov 2023 10:24:57 -0700 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=8D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/little-trains-beam.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/little-trains-beam.md diff --git a/.changeset/little-trains-beam.md b/.changeset/little-trains-beam.md new file mode 100644 index 000000000..3a912b05d --- /dev/null +++ b/.changeset/little-trains-beam.md @@ -0,0 +1,5 @@ +--- +'@myst-theme/common': patch +--- + +Move logo and logo_dark to options. From 14773e454826255840e9ea6b451b45fce4c0aaba Mon Sep 17 00:00:00 2001 From: Franklin Koch Date: Tue, 14 Nov 2023 10:25:21 -0700 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=91=A9=E2=80=8D=F0=9F=8E=A8=20Get=20d?= =?UTF-8?q?esign=20fields=20directly=20from=20options=20(#261)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/stupid-socks-report.md | 7 +++++++ packages/site/src/pages/Article.tsx | 2 +- themes/article/app/routes/$.tsx | 2 +- themes/book/app/routes/$.tsx | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/stupid-socks-report.md diff --git a/.changeset/stupid-socks-report.md b/.changeset/stupid-socks-report.md new file mode 100644 index 000000000..3ca9fefae --- /dev/null +++ b/.changeset/stupid-socks-report.md @@ -0,0 +1,7 @@ +--- +'@myst-theme/article': patch +'@myst-theme/site': patch +'@myst-theme/book': patch +--- + +Get design fields from options diff --git a/packages/site/src/pages/Article.tsx b/packages/site/src/pages/Article.tsx index d62ae9ed3..45aa96077 100644 --- a/packages/site/src/pages/Article.tsx +++ b/packages/site/src/pages/Article.tsx @@ -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 ?? []; diff --git a/themes/article/app/routes/$.tsx b/themes/article/app/routes/$.tsx index 3e4cc9585..437c9f08e 100644 --- a/themes/article/app/routes/$.tsx +++ b/themes/article/app/routes/$.tsx @@ -248,7 +248,7 @@ export function ArticlePage({ article }: { article: PageLoader }) { export default function Page() { // const { container, outline } = useOutlineHeight(); const article = useLoaderData() as PageLoader; - const { hide_outline } = (article.frontmatter as any)?.design ?? {}; + const { hide_outline } = (article.frontmatter as any)?.options ?? {}; return ( diff --git a/themes/book/app/routes/$.tsx b/themes/book/app/routes/$.tsx index 2a455b4cc..ff237a0dd 100644 --- a/themes/book/app/routes/$.tsx +++ b/themes/book/app/routes/$.tsx @@ -96,9 +96,9 @@ export default function Page() { const { container, outline } = useOutlineHeight(); const top = useThemeTop(); const article = useLoaderData() 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 (