Skip to content

Commit 53c0236

Browse files
committed
feat: change to never trailingSlash
1 parent 5282d5c commit 53c0236

14 files changed

Lines changed: 25 additions & 26 deletions

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const siteUrl =
3131
// https://astro.build/config
3232
export default defineConfig({
3333
site: siteUrl,
34-
trailingSlash: 'always',
34+
trailingSlash: 'never',
3535

3636
build: {
3737
inlineStylesheets: 'always',

src/components/BlogCard.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const coverImagePath = `/src/assets/blogimages/${post.data.pubId}/cover.jpg`
1717

1818
<a
1919
transition:name={`blog-card-${post.data.pubId}`}
20-
href={`/${locale}/posts/${id}/`}
20+
href={`/${locale}/posts/${id}`}
2121
class="group hover:bg-secondary dark:hover:bg-secondary-dark flex h-full flex-col gap-4 rounded-3xl p-3 pb-8 transition-colors"
2222
>
2323
{

src/components/Footer.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const today = new Date()
2727
WebsiteLinks.map((link) => (
2828
<a
2929
class="decoration-secondary dark:decoration-secondary-dark text-lg decoration-wavy underline-offset-2 hover:underline"
30-
href={`/${locale}/${link.url}`}
30+
href={`/${locale}${link.url}`}
3131
>
3232
{link.name[locale]}
3333
</a>

src/components/LocaleSelector.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const isActive = Astro.url.pathname.startsWith(`/${locale}/locale`)
88

99
<div class="flex items-center justify-center">
1010
<a
11-
href={`/${locale}/locale/`}
11+
href={`/${locale}/locale`}
1212
aria-label="Select Language"
1313
class:list={[`${className}`, { active: isActive }]}
1414
>

src/components/LocaleSuggest.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if (inArticle) {
8585
pathnames[3] !== ''
8686
) {
8787
// On /lang/posts/xxx -> redirect to /lang/posts/xxx in the suggested language
88-
targetPath = `/${lang}/posts/${translationMap[lang]}/`
88+
targetPath = `/${lang}/posts/${translationMap[lang]}`
8989
} else {
9090
// Default: redirect to the same page structure in the suggested language
9191
// Replace the current language with the suggested one

src/components/Navbar.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const locale = Astro.currentLocale as Lang
1414
<header class="fixed top-0 z-40 w-full bg-transparent backdrop-blur-sm">
1515
<nav>
1616
<div class="app-container flex items-center justify-between py-5">
17-
<a href={`/${locale}/`} aria-label="Home" transition:persist>
17+
<a href={`/${locale}`} aria-label="Home" transition:persist>
1818
<LogoSVG
1919
height={42}
2020
width={42}
@@ -26,7 +26,7 @@ const locale = Astro.currentLocale as Lang
2626
WebsiteLinks.map((link) => (
2727
<NavbarLink
2828
class="text-lg"
29-
href={`/${locale}/${link.url}`}
29+
href={`/${locale}${link.url}`}
3030
target={link.url.charAt(0) === 'h' ? '_blank' : '_self'}
3131
>
3232
{link.name[locale]}
@@ -65,7 +65,7 @@ const locale = Astro.currentLocale as Lang
6565
WebsiteLinks.map((link) => (
6666
<NavbarLink
6767
class="text-4xl font-light"
68-
href={`/${locale}/${link.url}`}
68+
href={`/${locale}${link.url}`}
6969
>
7070
{link.name[locale]}
7171
</NavbarLink>

src/components/NavbarLink.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const { pathname } = Astro.url
1111
const isActive =
1212
href === pathname ||
1313
href === pathname.replace(/\/$/, '') ||
14-
(pathname.startsWith(`/${locale}/posts/`) && href === `/${locale}/posts/`)
14+
(pathname.startsWith(`/${locale}/posts/`) && href === `/${locale}/posts`)
1515
---
1616

1717
<a href={href} class:list={[className, { active: isActive }]} {...props}>

src/components/TranslateToggle.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const { pubId } = Astro.props
4040
<span>
4141
<a
4242
class="group item-center flex gap-1"
43-
href={`/${lang}/posts/${postPath}/`}
43+
href={`/${lang}/posts/${postPath}`}
4444
aria-label={t({
4545
es: `Traducir al ${config.label}`,
4646
gl: `Traducir ao ${config.label}`,

src/consts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ type WebLinks = WebLink[]
6161

6262
export const WebsiteLinks: WebLinks = [
6363
{ name: { es: 'Principal', gl: 'Principal', en: 'Home' }, url: '' },
64-
{ name: { es: 'Artículos', gl: 'Artigos', en: 'Posts' }, url: 'posts/' },
64+
{ name: { es: 'Artículos', gl: 'Artigos', en: 'Posts' }, url: '/posts' },
6565
{
6666
name: { es: 'Acerca de Mí', gl: 'Eu', en: 'About Me' },
67-
url: 'about/',
67+
url: '/about',
6868
},
6969
]
7070

src/pages/[lang]/404.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const getStaticPaths = () =>
3030
})
3131
}
3232
</p>
33-
<a class="btn-primary" href={`/${locale}/`}>
33+
<a class="btn-primary" href={`/${locale}`}>
3434
{
3535
t({
3636
es: 'Ir a la página principal',

0 commit comments

Comments
 (0)