From 9bc15385b534dc4da4f5bcd46f26d2e1815f1945 Mon Sep 17 00:00:00 2001 From: Agah Date: Thu, 12 Sep 2024 22:12:27 -0400 Subject: [PATCH 1/3] [ENH] Enable remote content server connection - Update for both article/book themes - Update dev documentation --- README.md | 6 ++++++ themes/article/app/utils/loaders.server.ts | 2 +- themes/book/app/utils/loaders.server.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a2d29f2d..f5b929b69 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,12 @@ To run on a specific port (for example, developing locally between two projects) myst start --headless --server-port 3111 CONTENT_CDN_PORT=3111 npm run theme:book ``` +To connect to a remote content server, set the `CONTENT_CDN` environment variable: + +```bash +CONTENT_CDN=https://remote.example.com npm run theme:book +CONTENT_CDN=https://remote.example.com npm run theme:article +``` ## Deployment diff --git a/themes/article/app/utils/loaders.server.ts b/themes/article/app/utils/loaders.server.ts index bf9ab3063..ce95a1dd3 100644 --- a/themes/article/app/utils/loaders.server.ts +++ b/themes/article/app/utils/loaders.server.ts @@ -11,7 +11,7 @@ import { import { responseNoArticle, responseNoSite, getDomainFromRequest } from '@myst-theme/site'; const CONTENT_CDN_PORT = process.env.CONTENT_CDN_PORT ?? '3100'; -const CONTENT_CDN = `http://localhost:${CONTENT_CDN_PORT}`; +const CONTENT_CDN = process.env.CONTENT_CDN ?? `http://localhost:${CONTENT_CDN_PORT}`; export async function getConfig(): Promise { const url = `${CONTENT_CDN}/config.json`; diff --git a/themes/book/app/utils/loaders.server.ts b/themes/book/app/utils/loaders.server.ts index 502827d87..dc0bdce73 100644 --- a/themes/book/app/utils/loaders.server.ts +++ b/themes/book/app/utils/loaders.server.ts @@ -11,7 +11,7 @@ import { redirect } from '@remix-run/node'; import { responseNoArticle, responseNoSite, getDomainFromRequest } from '@myst-theme/site'; const CONTENT_CDN_PORT = process.env.CONTENT_CDN_PORT ?? '3100'; -const CONTENT_CDN = `http://localhost:${CONTENT_CDN_PORT}`; +const CONTENT_CDN = process.env.CONTENT_CDN ?? `http://localhost:${CONTENT_CDN_PORT}`; export async function getConfig(): Promise { const url = `${CONTENT_CDN}/config.json`; From 35e81e0da627dff739ef01e15fc1757dcf66e944 Mon Sep 17 00:00:00 2001 From: Agah Date: Thu, 12 Sep 2024 22:15:21 -0400 Subject: [PATCH 2/3] [ENH] Enable theme switcher for the article theme --- themes/article/app/components/ArticlePageAndNavigation.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/themes/article/app/components/ArticlePageAndNavigation.tsx b/themes/article/app/components/ArticlePageAndNavigation.tsx index 4ad72ba37..50564027e 100644 --- a/themes/article/app/components/ArticlePageAndNavigation.tsx +++ b/themes/article/app/components/ArticlePageAndNavigation.tsx @@ -1,10 +1,14 @@ import { GridSystemProvider, TabStateProvider, UiStateProvider } from '@myst-theme/providers'; +import { ThemeButton } from '@myst-theme/site'; export function ArticlePageAndNavigation({ children }: { children: React.ReactNode }) { return ( +
+ +
{children}
From b71b6b11fd645a2f780799229ad5a94fb448ec4f Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Thu, 12 Sep 2024 20:48:53 -0600 Subject: [PATCH 3/3] Create nice-suns-crash.md --- .changeset/nice-suns-crash.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/nice-suns-crash.md diff --git a/.changeset/nice-suns-crash.md b/.changeset/nice-suns-crash.md new file mode 100644 index 000000000..ef2b47298 --- /dev/null +++ b/.changeset/nice-suns-crash.md @@ -0,0 +1,6 @@ +--- +"@myst-theme/article": patch +"@myst-theme/book": patch +--- + +Remote CDN and theme button for the article theme