Skip to content

Commit 1c3c89b

Browse files
committed
rewrite image paths to include the base URL '/fun-rec'
1 parent 8a9daa8 commit 1c3c89b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@
2828
noData: '找不到结果!',
2929
},
3030
relativePath: true,
31+
plugins: [
32+
function(hook) {
33+
hook.beforeEach(function(content) {
34+
// Check if on GitHub Pages
35+
if (window.location.hostname === 'datawhalechina.github.io') {
36+
// Rewrite image paths to include the base URL '/fun-rec'
37+
return content.replace(/src="(\.\.\/)*imgs\//g, 'src="/fun-rec/imgs/');
38+
}
39+
return content;
40+
});
41+
}
42+
]
3143
}
3244
</script>
3345

0 commit comments

Comments
 (0)