Fix broken download links
BNR info-hub Technical Manual
1 Fix broken download links
1.1 Purpose
Use this guide when a link on the website does not open a table, figure, metadata file, build file, or PDF briefing.
Broken links usually come from:
- the file was not copied into
site/downloads/files/ - the relative path is wrong
- the file name changed
- the site was not rerendered after adding the file
2 Stage 1: Identify the page and link
NoteStep 1. Record the failing link
Record:
- the page containing the link
- the link text
- the expected file
- the error seen in the browser
Example:
Page: site/downloads/index.qmd
Link: Download cumulative weekly case data
Expected file: cases_2023_cum_week.csv
3 Stage 2: Check whether the file exists
NoteStep 1. Check the site download folder
cd C:\yoshimi-hot\output\analyse-bnr\info-hub
Get-ChildItem site\downloads\files\briefings\cvd_cases_2023_v1 -RecurseConfirm the file exists with the exact spelling used in the link.
4 Stage 3: Check relative links
4.1 Links from the case-count HTML briefing
The HTML briefing lives here:
site/surveillance/cvd/briefings/case-counts.qmd
Links from this file to the site download folder should start with:
../../../downloads/files/briefings/cvd_cases_2023_v1/
Example:
[Download cumulative weekly case data](../../../downloads/files/briefings/cvd_cases_2023_v1/data/cases_2023_cum_week.csv)5 Stage 4: Check PDF links
Quarto-generated PDFs are generated during render.
If the PDF QMD is:
site/surveillance/cvd/briefings/case-counts-pdf.qmd
the rendered PDF should appear under:
site/_site/surveillance/cvd/briefings/bnr_cvd_cases_2023_v1.pdf
From the HTML briefing, use a local link such as:
[Download the PDF briefing](bnr_cvd_cases_2023_v1.pdf)6 Stage 5: Rerender and retest
cd C:\yoshimi-hot\output\analyse-bnr\info-hub\site
quarto preview --port 4200Then retest the link in the browser.