diff --git a/.env b/.env deleted file mode 100644 index a0cdbd6..0000000 --- a/.env +++ /dev/null @@ -1,3 +0,0 @@ -DOMAIN="martials.no" -GIT_URL=https://git.$DOMAIN -STATUS_URL="https://status.$DOMAIN/status/home" \ No newline at end of file diff --git a/astro.config.mjs b/astro.config.mjs index 4c63199..f5fef6d 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -39,10 +39,7 @@ export default defineConfig({ }), env: { schema: { - DOMAIN: envField.string({ context: "client", access: "public" }), - URL: envField.string({ context: "client", access: "public" }), - GIT_URL: envField.string({ context: "client", access: "public" }), - STATUS_URL: envField.string({ context: "client", access: "public" }) + URL: envField.string({ context: "client", access: "public" }) } } }) \ No newline at end of file diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 03b25c1..96a8270 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,20 +1,19 @@ --- import GiteaLink from "./links/GiteaLink.astro" -import PajamasIcon from "./icons/PajamasIcon.astro" import ExternalLink from "./links/ExternalLink.astro" import LanguageButtonGroup from "./LanguageButtonGroup.astro" -import { GIT_URL, STATUS_URL } from "astro:env/client" import * as m from "@/paraglide/messages" - -const giteaLink = `${GIT_URL}/martials/martials.no` +import { LINKED_IN_URL, THIS_GIT_URL, STATUS_URL } from "../constants" ---
{message}
diff --git a/src/components/myLinks/myLinks.ts b/src/components/myLinks/myLinks.ts index 3de998b..8d4ba07 100644 --- a/src/components/myLinks/myLinks.ts +++ b/src/components/myLinks/myLinks.ts @@ -1,6 +1,6 @@ import type { PajamasIcon } from "@/types/icons.ts" -import { GIT_URL } from "astro:env/client" import * as m from "@/paraglide/messages" +import * as c from "@/constants.ts" export interface MyLink { title: string; @@ -12,35 +12,35 @@ export interface MyLink { export default [ { title: "GitHub", - url: "https://github.com/emberal", + url: c.GITHUB_PROFILE_URL, icon: "pajamas:github" }, { title: "Gitea", - url: `${GIT_URL}/martials`, + url: c.GIT_PROFILE_URL, message: m.forPersonalProjects(), icon: "pajamas:gitea" }, { title: "LinkedIn", - url: "https://www.linkedin.com/in/martin-b-2a69391a3/", + url: c.LINKED_IN_URL, icon: "pajamas:linkedin" }, { title: "Mastodon (Snabelen)", - url: "https://snabelen.no/@Martials", + url: c.MASTODON_URL, icon: "pajamas:mastodon" }, { title: "Pixelfed", - url: "https://pixelfed.social/i/web/profile/261454857934868480" + url: c.PIXELFED_URL }, { title: "Steam", - url: "https://steamcommunity.com/id/martials/" + url: c.STEAM_URL }, { title: "Trakt.tv", - url: "https://trakt.tv/users/martials" + url: c.TRAKT_URL } ] satisfies MyLink[] diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..d3ccfa6 --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,11 @@ +export const DOMAIN = "martials.no" +export const LINKED_IN_URL = "https://www.linkedin.com/in/martin-b-2a69391a3" +export const GIT_BASE_URL = `https://git.${DOMAIN}` +export const GIT_PROFILE_URL = `${GIT_BASE_URL}/martials` +export const GITHUB_PROFILE_URL = "https://github.com/emberal" +export const MASTODON_URL = "https://snabelen.no/@Martials" +export const PIXELFED_URL = "https://pixelfed.social/i/web/profile/261454857934868480" +export const STEAM_URL = "https://steamcommunity.com/id/martials/" +export const THIS_GIT_URL = `${GIT_BASE_URL}/martials/martials.no` +export const TRAKT_URL = "https://trakt.tv/users/martials" +export const STATUS_URL = `https://status.${DOMAIN}/status/home` diff --git a/src/utils/linking.ts b/src/utils/linking.ts index eeb7fd1..6ba823b 100644 --- a/src/utils/linking.ts +++ b/src/utils/linking.ts @@ -58,8 +58,9 @@ export function localizePathname( } export function resolvePathname(pathname: string): AbsolutePathname { - if (pathname.startsWith("/en")) { - return pathname.slice(3) as AbsolutePathname + const enPattern = "/en" + if (pathname.startsWith(enPattern)) { + return pathname.slice(enPattern.length) as AbsolutePathname } return pathname as AbsolutePathname }