Skip to content

Commit eb8c747

Browse files
authored
MAINT: In Netlify previews, publish at a /blog path (#59)
1 parent e3d01d9 commit eb8c747

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

netlify.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
# Netlify configuration for PR previews - this is NOT for the live site! That uses GH actions
22
[build]
3-
publish = "docs/_build/html"
4-
environment = { PYTHON_VERSION = "3.12" }
3+
# Netlify previews are served from ./publish with the site nested in /blog.
4+
# This keeps BASE_URL=/blog working since we intend to proxiy the blog at jupyterbook.org/blog.
5+
publish = "publish"
6+
environment = { PYTHON_VERSION = "3.12", BASE_URL = "/blog" }
57
command = """
68
pip install pyyaml && \
79
python src/download_nav_items.py && \
810
npm install -g mystmd@latest && \
9-
cd docs && myst build --html -d
11+
cd docs && \
12+
myst build --html -d && \
13+
mkdir -p ../publish/blog && \
14+
mv _build/html/* ../publish/blog/ && \
15+
if [ "$CONTEXT" = "deploy-preview" ]; then \
16+
printf "/ /blog/ 302\n" > ../publish/_redirects; \
17+
fi
1018
"""
1119

1220
# Keep all deploy contexts out of search indexing because we use github actions for the live site

0 commit comments

Comments
 (0)