Skip to content

Commit

Permalink
declare base once per route
Browse files Browse the repository at this point in the history
  • Loading branch information
haxibami committed Jun 20, 2024
1 parent 5ac7fd8 commit fd36064
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/CopyAssetIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ export default function CopyAssetIntegration(): AstroIntegration {
const source = await read(path);
const hast = parser.parse(source);

const base = new URL(
join(relative("src/pages", dirname(component)), sep),
ORIGINS[0],
);

for (const tag of selectAll("a", hast)) {
const base = new URL(
join(relative("src/pages", dirname(component)), sep),
ORIGINS[0],
);
const href = tag.properties?.href;
if (typeof href !== "string") continue;
const absoluteUrl = new URL(href, base);
Expand Down

0 comments on commit fd36064

Please sign in to comment.