mirror of
https://github.com/mikkelsvartveit/astro-personal-website.git
synced 2025-12-22 19:22:37 +00:00
Fix trailing slash issue
asdf dsfa
This commit is contained in:
parent
85c3b6174b
commit
c53b4efd60
2 changed files with 5 additions and 5 deletions
|
|
@ -2,6 +2,7 @@
|
|||
import { slide, fade } from "svelte/transition";
|
||||
|
||||
export let currentPath: string;
|
||||
$: currentPathTrimmed = currentPath.replace(/\/+$/, "");
|
||||
|
||||
let scrollPosition = 0;
|
||||
$: isScrolled = scrollPosition > 0;
|
||||
|
|
@ -28,7 +29,7 @@
|
|||
href="/"
|
||||
data-sveltekit-preload-code="eager"
|
||||
class="text-lg tracking-wide text-gray-600 decoration-yellow-400 decoration-2 underline-offset-8 duration-100 hover:text-gray-400"
|
||||
class:underline={"/" === currentPath}
|
||||
class:underline={"" === currentPathTrimmed}
|
||||
>
|
||||
Mikkel Svartveit
|
||||
</a>
|
||||
|
|
@ -40,7 +41,7 @@
|
|||
{href}
|
||||
data-sveltekit-preload-code="eager"
|
||||
class="text-lg tracking-wide text-gray-600 decoration-yellow-400 decoration-2 underline-offset-8 duration-100 hover:text-gray-400"
|
||||
class:underline={href === currentPath}
|
||||
class:underline={href === currentPathTrimmed}
|
||||
>
|
||||
{name}
|
||||
</a>
|
||||
|
|
@ -107,7 +108,7 @@
|
|||
{href}
|
||||
on:click={() => (collapsed = true)}
|
||||
class="whitespace-nowrap text-lg tracking-wide text-gray-600 decoration-yellow-400 decoration-2 underline-offset-8"
|
||||
class:underline={href === currentPath}
|
||||
class:underline={href === currentPathTrimmed}
|
||||
>
|
||||
{name}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ const sortFiles = (a: any, b: any) => {
|
|||
export const getFileNameFromPath = (path: string) => {
|
||||
const parts = path.split("/");
|
||||
const fileName = parts[parts.length - 1].split("?")[0];
|
||||
const fileNameParts = fileName.split(".");
|
||||
return fileNameParts[0] + "." + fileNameParts[fileNameParts.length - 1];
|
||||
return fileName.split(".")[0];
|
||||
};
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue