fix: add trailing slash to links to avoid extra redirects (#246)

Add trailing slash to links for improved consistency with RSS links and to avoid unnecessary redirects.

---------

Co-authored-by: satnaing <satnaingdev@gmail.com>
This commit is contained in:
面条
2024-01-25 11:54:28 +08:00
committed by GitHub
parent b05ab6213e
commit b3a1d9d369
8 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ breadcrumbList[0] === "tags" &&
</li>
) : (
<li>
<a href={`/${breadcrumb}`}>{breadcrumb}</a>
<a href={`/${breadcrumb}/`}>{breadcrumb}</a>
<span aria-hidden="true">&raquo;</span>
</li>
)
+4 -4
View File
@@ -56,23 +56,23 @@ const { activeNav } = Astro.props;
</button>
<ul id="menu-items" class="display-none sm:flex">
<li>
<a href="/posts" class={activeNav === "posts" ? "active" : ""}>
<a href="/posts/" class={activeNav === "posts" ? "active" : ""}>
Posts
</a>
</li>
<li>
<a href="/tags" class={activeNav === "tags" ? "active" : ""}>
<a href="/tags/" class={activeNav === "tags" ? "active" : ""}>
Tags
</a>
</li>
<li>
<a href="/about" class={activeNav === "about" ? "active" : ""}>
<a href="/about/" class={activeNav === "about" ? "active" : ""}>
About
</a>
</li>
<li>
<LinkButton
href="/search"
href="/search/"
className={`focus-outline p-3 sm:p-1 ${
activeNav === "search" ? "active" : ""
} flex`}
+1 -1
View File
@@ -112,7 +112,7 @@ export default function SearchBar({ searchList }: Props) {
{searchResults &&
searchResults.map(({ item, refIndex }) => (
<Card
href={`/posts/${item.slug}`}
href={`/posts/${item.slug}/`}
frontmatter={item.data}
key={`${refIndex}-${item.slug}`}
/>
+1 -1
View File
@@ -13,7 +13,7 @@ const { tag, size = "sm" } = Astro.props;
}`}
>
<a
href={`/tags/${tag}`}
href={`/tags/${tag}/`}
transition:name={tag}
class={`${size === "sm" ? "text-sm" : "text-lg"} pr-2 group`}
>