Skip to content

Commit

Permalink
update(astro): to v4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
erkobridee committed May 24, 2024
1 parent 39dfe06 commit 965109a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"dbaeumer.vscode-eslint",
"astro-build.astro-vscode",
"bradlc.vscode-tailwindcss",
"unifiedjs.vscode-mdx"
"unifiedjs.vscode-mdx",
"meganrogge.template-string-converter"
],
"settings": {
"files.autoSave": "onFocusChange",
Expand Down
17 changes: 8 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
},
"devDependencies": {
"@astrojs/check": "0.7.0",
"@astrojs/mdx": "3.0.0",
"@astrojs/mdx": "3.0.1",
"@astrojs/tailwind": "5.1.0",
"@types/canvas-confetti": "1.6.4",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.9.0",
"astro": "4.8.6",
"astro": "4.9.1",
"autoprefixer": "10.4.19",
"cross-env": "^7.0.3",
"eslint": "8.57.0",
Expand Down
17 changes: 13 additions & 4 deletions src/components/Link.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ let extraLinkProps: HTMLAttributes<'a'> = {
if (!external) {
const baseUrl = `${import.meta.env.BASE_URL}`;
let newHref = baseUrl;
const hrefStartWithSlash = href.startsWith('/');
if (baseUrl === '/') {
newHref = hrefStartWithSlash ? href : `/${href}`;
} else {
const baseUrlEndWithSlash = baseUrl.endsWith('/');
newHref = `${baseUrl}${!baseUrlEndWithSlash && !hrefStartWithSlash ? `/` : ''}${href}`;
}
extraLinkProps = {
href:
href === '/'
? `${baseUrl}`
: `${baseUrl}${!href.startsWith('/') ? '/' : ''}${href}`,
href: newHref,
rel: 'prefetch'
};
}
Expand Down

0 comments on commit 965109a

Please sign in to comment.