Skip to content

Commit 7f14daa

Browse files
committed
fix _site
1 parent 1eecd82 commit 7f14daa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

assets/scripts/notebooks/notebooks.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,14 @@ function convert_qmd_to_ipynb(in_qmd_path::String, out_ipynb_path::String)
147147
end
148148

149149
function add_ipynb_link_to_html(html_path::String, ipynb_path::String)
150-
PATH_PREFIX = get(ENV, "PATH_PREFIX", "")
151-
COLAB_URL = "https://colab.research.google.com/github/TuringLang/docs/blob/gh-pages$PATH_PREFIX/$ipynb_path"
150+
# this would look like "getting-started.ipynb" and is used when downloading a notebook
152151
SUGGESTED_FILENAME = basename(dirname(ipynb_path)) * ".ipynb"
152+
# The Colab URL needs to look like
153+
# https://colab.research.google.com/github/TuringLang/docs/blob/gh-pages/path/to/notebook.ipynb
154+
# Because ipynb_path has `_site/` prefix, we need to strip that off.
155+
ipynb_path_no_site = replace(ipynb_path, r"^_site/" => "")
156+
PATH_PREFIX = get(ENV, "PATH_PREFIX", "")
157+
COLAB_URL = "https://colab.research.google.com/github/TuringLang/docs/blob/gh-pages$PATH_PREFIX/$ipynb_path_no_site"
153158
@info "adding link to ipynb notebook in $html_path... with PATH_PREFIX='$PATH_PREFIX'"
154159
if !isfile(html_path)
155160
@info " - HTML file $html_path does not exist; skipping"

0 commit comments

Comments
 (0)