Skip to content

Commit 98cf5d1

Browse files
Add links to preview sites for PRs (#569)
1 parent d567bb1 commit 98cf5d1

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: doc-serve shortcode-docs docs scipy main blog learn tools serve-dev
1+
.PHONY: doc-serve shortcode-docs netlify-preview preview-theme theme docs scipy main blog learn tools serve-dev
22
.DEFAULT_GOAL := doc-serve
33

44
GH_ORG = scientific-python
@@ -32,12 +32,16 @@ doc-serve: doc/content/shortcodes.md
3232
# The following is for use on netlify
3333
# -----------------------------------
3434

35-
netlify-preview: theme scipy main blog learn tools
35+
netlify-preview: preview-theme theme scipy main blog learn tools
3636
mv scipy/public doc/public/scipy
3737
mv main/public doc/public/main
3838
mv blog/public doc/public/blog
3939
mv learn/public doc/public/learn
4040
mv tools/public doc/public/tools
41+
git restore doc/content/_index.md
42+
43+
preview-theme:
44+
python tools/add_preview_links.py
4145

4246
theme: doc/content/shortcodes.md
4347
(cd doc ; hugo --themesDir="../..")

README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,3 @@ The **Scientific Python Hugo Theme** is a theme for the
77
Please see the [theme
88
documentation](https://theme.scientific-python.org), especially the
99
[get started](https://theme.scientific-python.org/getstarted/) page.
10-
11-
## Theme development
12-
13-
When making PRs against this repository, a site preview of the theme
14-
documentation will be rendered. From there, you can browse preview
15-
builds of a few other community websites: `scipy`, `main`
16-
(scientific-python.org), `blog`, and `learn`. E.g., if the preview link is
17-
18-
https://deploy-preview-301--scientific-python-hugo-theme.netlify.app/
19-
20-
browse to
21-
22-
https://deploy-preview-301--scientific-python-hugo-theme.netlify.app/blog
23-
24-
to see how the blog rendered.

tools/add_preview_links.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
filename = "doc/content/_index.md"
2+
preview_links = """
3+
{{< admonition attention >}}
4+
See scientific python, [blog](blog), learn, [tools](tools), scipy, and numpy.
5+
{{< /admonition >}}
6+
"""
7+
8+
with open(filename, "r") as f:
9+
index = f.readlines()
10+
11+
with open(filename, "w") as f:
12+
index.insert(3, preview_links)
13+
index = "".join(index)
14+
f.write(index)

0 commit comments

Comments
 (0)