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";
|
import { slide, fade } from "svelte/transition";
|
||||||
|
|
||||||
export let currentPath: string;
|
export let currentPath: string;
|
||||||
|
$: currentPathTrimmed = currentPath.replace(/\/+$/, "");
|
||||||
|
|
||||||
let scrollPosition = 0;
|
let scrollPosition = 0;
|
||||||
$: isScrolled = scrollPosition > 0;
|
$: isScrolled = scrollPosition > 0;
|
||||||
|
|
@ -28,7 +29,7 @@
|
||||||
href="/"
|
href="/"
|
||||||
data-sveltekit-preload-code="eager"
|
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="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
|
Mikkel Svartveit
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -40,7 +41,7 @@
|
||||||
{href}
|
{href}
|
||||||
data-sveltekit-preload-code="eager"
|
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="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}
|
{name}
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -107,7 +108,7 @@
|
||||||
{href}
|
{href}
|
||||||
on:click={() => (collapsed = true)}
|
on:click={() => (collapsed = true)}
|
||||||
class="whitespace-nowrap text-lg tracking-wide text-gray-600 decoration-yellow-400 decoration-2 underline-offset-8"
|
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}
|
{name}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,7 @@ const sortFiles = (a: any, b: any) => {
|
||||||
export const getFileNameFromPath = (path: string) => {
|
export const getFileNameFromPath = (path: string) => {
|
||||||
const parts = path.split("/");
|
const parts = path.split("/");
|
||||||
const fileName = parts[parts.length - 1].split("?")[0];
|
const fileName = parts[parts.length - 1].split("?")[0];
|
||||||
const fileNameParts = fileName.split(".");
|
return fileName.split(".")[0];
|
||||||
return fileNameParts[0] + "." + fileNameParts[fileNameParts.length - 1];
|
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue