Skip to content

Commit 7a22388

Browse files
committed
Fix image links
1 parent f29e4d7 commit 7a22388

File tree

7 files changed

+29
-7
lines changed

7 files changed

+29
-7
lines changed

docs/assets/index-BIE7Fa7C.js renamed to docs/assets/index-BL9t59m-.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/virtual_pwa-register-CWSUTgCj.js renamed to docs/assets/virtual_pwa-register-9TPjRBsB.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
1212
<link rel="shortcut icon" href="/favicon.ico">
1313
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
14-
<script type="module" crossorigin src="/assets/index-BIE7Fa7C.js"></script>
14+
<script type="module" crossorigin src="/assets/index-BL9t59m-.js"></script>
1515
<link rel="stylesheet" crossorigin href="/assets/index-icmCO1YT.css">
1616
<link rel="manifest" href="/manifest.webmanifest"></head>
1717
<body>

docs/sw.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/components/EntityCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { A } from '@solidjs/router'
22
import { Show } from 'solid-js'
33
import RankBadge from './RankBadge'
4+
import { resolveImageUrl } from '../data/index'
45

56
export interface EntityCardProps {
67
/** Unique identifier for the entity (used for routing) */
@@ -40,7 +41,7 @@ function EntityCard(props: EntityCardProps) {
4041
<div class="entity-card-content">
4142
<div class="entity-image">
4243
<img
43-
src={props.imageUrl || '/unknown-192.png'}
44+
src={resolveImageUrl(props.imageUrl) || resolveImageUrl('/unknown-192.png') || '/unknown-192.png'}
4445
alt={props.name}
4546
loading="lazy"
4647
/>

site/src/data/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,27 @@ export async function clearDataCache(filename?: string): Promise<void> {
321321
}
322322
}
323323

324+
// Helper function to resolve image URLs with the correct base path
325+
export function resolveImageUrl(imageUrl: string | null | undefined): string | null {
326+
if (!imageUrl) return null
327+
328+
// If it's already an absolute URL (http/https), return as-is
329+
if (imageUrl.startsWith('http://') || imageUrl.startsWith('https://')) {
330+
return imageUrl
331+
}
332+
333+
// Get the base path from Vite's import.meta.env
334+
const basePath = import.meta.env.BASE_URL || '/'
335+
336+
// Remove leading slash from imageUrl if present, then combine with base path
337+
const cleanImageUrl = imageUrl.startsWith('/') ? imageUrl.slice(1) : imageUrl
338+
339+
// Ensure base path ends with slash
340+
const cleanBasePath = basePath.endsWith('/') ? basePath : `${basePath}/`
341+
342+
return `${cleanBasePath}${cleanImageUrl}`
343+
}
344+
324345
// Check if we're currently offline
325346
export function isOffline(): boolean {
326347
return !navigator.onLine

site/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default defineConfig(({ mode }) => {
8383
},
8484
}),
8585
],
86-
base: env.AETHERIA_BASE_PATH || '/',
86+
base: env.AETHERIA_BASE_PATH || (mode === 'production' ? '/Aetheria/' : '/'),
8787
build: {
8888
outDir: '../docs',
8989
emptyOutDir: true,

0 commit comments

Comments
 (0)