Skip to content

Commit 9bfb143

Browse files
committed
fix(home): resolve blog article links under /blog/
1 parent 31f850b commit 9bfb143

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎build_spa.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def build(wiki_base: str, out_dir: pathlib.Path, subsets: set, with_fonts: bool)
149149
)
150150
html = sub(
151151
html,
152-
"new URL(href, window.location.href).href",
152+
"new URL(href, new URL('/blog/', window.location.href)).href",
153153
"new URL(href, '%s/blog/').href" % wiki_base,
154154
expect=1,
155155
)

‎overrides/home.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ <h3><span data-i18n="join.titleOne"></span> <em data-i18n="join.titleTwo"></em><
20722072
Array.prototype.slice.call(articles, 0, 6).forEach(function (article) {
20732073
var titleEl = article.querySelector('h2 a.toclink, h2 a'); if (!titleEl) return;
20742074
var href = titleEl.getAttribute('href') || '/blog/';
2075-
var item = document.createElement('a'); item.className = 'blog-item'; item.href = new URL(href, window.location.href).href;
2075+
var item = document.createElement('a'); item.className = 'blog-item'; item.href = new URL(href, new URL('/blog/', window.location.href)).href;
20762076
var date = document.createElement('span'); date.className = 'blog-date'; var time = article.querySelector('time'); date.textContent = time ? time.textContent.trim() : 'RESEARCH';
20772077
var isQiling = href.indexOf('qiling_') !== -1 || titleEl.textContent.indexOf('Qiling') !== -1 || titleEl.textContent.indexOf('起零衍迹') !== -1;
20782078
var source = document.createElement('span'); source.className = 'blog-source'; source.dataset.blogSource = isQiling ? 'qiling' : 'journal'; source.textContent = isQiling ? text('blog.sourceQiling') : text('blog.sourceJournal');

0 commit comments

Comments
 (0)