Skip to content

Add local codes/ folder for MCS tutorials, replace upstream links with downloads - #138

Open
marcusr2ML wants to merge 4 commits into
ALPSim:mainfrom
marcusr2ML:feat/mcs-local-downloads
Open

Add local codes/ folder for MCS tutorials, replace upstream links with downloads#138
marcusr2ML wants to merge 4 commits into
ALPSim:mainfrom
marcusr2ML:feat/mcs-local-downloads

Conversation

@marcusr2ML

@marcusr2ML marcusr2ML commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Follows the same pattern as #132 (DMRG) and the existing ED tutorials.

Simple test the links work.

Note some of the parameter files are inconsistent with the text (falgged below). I will fix these on a separate PR.

(CLAUDE)

Problem

Every parameter-file and script link on the Monte Carlo tutorial pages pointed at github.com/ALPSim/ALPS/blob/master/... and carried a download attribute:

<a href="https://github.com/ALPSim/ALPS/blob/master/tutorials/mc-03-magnetization/parm3a" download>parm3a</a>

The download attribute is ignored on cross-origin links, so it never had any effect — clicking one navigated the reader off to GitHub instead of saving the file. Readers left the site to get a two-line parameter file.

Change

  • Vendor the 46 linked files under content/en/tutorials/mcs/codes/<tutorial>/, mirroring the layout already used by the ED tutorials.
  • Repoint all 46 links at ../codes/<tutorial>/<file>. Same-origin links honour download, so the file now saves and the reader stays on the page.

Nine pages touched: mc01a, mc01b, mc02mc08. No prose, parameters, or figures were changed — this is a link-plumbing change only.

Verification

  • hugo --gc --minify builds clean; all 46 files publish to public/tutorials/mcs/codes/.
  • All 46 download URLs return 200 on a local hugo server.
  • No github.com/ALPSim/ALPS/blob links remain anywhere under content/en/tutorials/mcs/.

Known follow-up

The vendored files are copied verbatim from ALPSim/ALPS master. Seven of them differ from the code blocks printed on the pages — parm2a, parm2b, parm3a, parm3b, parm4, parm6a, parm6d — mostly in SWEEPS/THERMALIZATION (statistics only, no effect on the plotted curves), but parm3b differs in its field grid and parm6a omits T_MIN/T_MAX/DELTA_T that the command-line workflow needs. Reconciling page text against these files is left to a separate PR, since it needs a physics call rather than a text edit.

🤖 Generated with Claude Code

The parameter-file and script links on the Monte Carlo tutorial pages
pointed at github.com/ALPSim/ALPS blob URLs. The `download` attribute is
ignored on cross-origin links, so clicking one navigated the reader off
to GitHub rather than saving the file.

Vendor the 46 linked files under content/en/tutorials/mcs/codes/,
mirroring the layout already used by the ED tutorials, and repoint every
link at ../codes/<tutorial>/<file>. Same-origin links honour `download`,
so readers now stay on the page.

Files are copied verbatim from ALPSim/ALPS master. Several parameter
files differ from the code blocks shown on the pages (parm2a, parm2b,
parm3a, parm3b, parm4, parm6a, parm6d); reconciling those is left to a
follow-up.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Marcus Rosales and others added 3 commits August 11, 2026 15:05
Same change as the DMFT branch, in response to the review there: keeping
copies of the tutorial scripts in the website repo means two copies that
inevitably drift apart.

Drop the 46 vendored files under content/en/tutorials/mcs/codes/ and point
the links back at ALPSim/ALPS. To keep the reader on the page -- the reason
the copies were vendored -- add a click handler that fetches the raw file
and saves it via a blob URL. The HTML download attribute is ignored
cross-origin, but raw.githubusercontent.com sends
access-control-allow-origin: *, so the fetch is permitted and the blob
counts as same-origin for the purposes of download.

The links are pinned to daa7392 rather than tracking master, matching the
DMFT branch: the pages reproduce each file inline, so tracking master
would let the displayed text and the downloaded file diverge silently.
All 46 paths were confirmed to resolve at that commit.

The handler and its baseof.html wiring are byte-identical to the copies on
feat/dmft-local-downloads, so the two branches merge cleanly in either
order. Whichever lands second contributes only its content changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Point the MCS downloads at the master branch of ALPSim/ALPS instead of
pinning them to commit daa7392, so the tutorials serve the current
source rather than a snapshot that silently goes stale.

Bring the Japanese and Chinese MCS pages in line with the English ones.
They still used `<a href=".../blob/master/..." download>`, which does
not download: the `download` attribute is ignored cross-origin, and a
blob/ URL serves GitHub's HTML page rather than the file, so those
links navigated the reader away from the tutorial. They now use the
same alps-download anchors against raw.githubusercontent.com.

Note: en mc08 has two links (parm8c, tutorial8c.py) with no counterpart
in the translations, which predates this change and is left alone.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The link sat on the words "downloadable file" while the filename it
saves, `parm1a`, sat unlinked right after it. Move the anchor onto
`parm1a` so the clickable text names the file the reader gets.

This was the only download link in the MCS series whose text was not
the filename; all 46 now match.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant