We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f793704 commit 7efc167Copy full SHA for 7efc167
1 file changed
src/components/projects/ProjectBrowser.astro
@@ -157,8 +157,17 @@ async function getFigureFromPath(path: string) {
157
return await getContentFromPath('figure', figureRecord, path);
158
}
159
160
+const BASE_URL = import.meta.env.BASE_URL;
161
+
162
+function rebasePath(path: string | undefined): string | undefined {
163
+ while(path && path[0] === '/')
164
+ path = path.slice(1);
165
+ if(!path) return undefined;
166
+ return BASE_URL + path;
167
+}
168
169
function expandImagePath(fn: string) {
- const result = getImagePath(imagePaths, prepath, fn);
170
+ const result = rebasePath(getImagePath(imagePaths, prepath, fn));
171
if(!result) {
172
console.warn('Could not expand path:', fn);
173
return null;
0 commit comments