From 70129d7a0ed46ede69ba3bca5031414f096d86c2 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Fri, 9 Jan 2026 05:27:48 +0400 Subject: [PATCH] Added the store for dynamically changing the popup titles --- src/routes/+layout.svelte | 5 +++++ src/stores/popup.ts | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/stores/popup.ts diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index a7b87e2..45652f7 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,6 +4,7 @@ import Footer from "$components/layout/Footer.svelte"; import { initializeLinksReplacement } from "$lib/popup-links"; import { onDestroy } from "svelte"; + import { headTitle } from "$stores/popup"; interface Props { children?: import('svelte').Snippet; @@ -22,6 +23,10 @@ }) + + {$headTitle} + +
{@render children?.()} diff --git a/src/stores/popup.ts b/src/stores/popup.ts new file mode 100644 index 0000000..c874382 --- /dev/null +++ b/src/stores/popup.ts @@ -0,0 +1,15 @@ +import { derived, writable } from "svelte/store"; +import { PLUGIN_NAME } from "$lib/constants"; + +/** + * Store containing the name of the subpage. This name will be added to the title alongside the name of the plugin. + */ +export const popupTitle = writable(null); + +/** + * Name of the current route with the name of the plugin appended to it. + */ +export const headTitle = derived( + popupTitle, + $popupTitle => ($popupTitle ? `${$popupTitle} | ` : '') + PLUGIN_NAME +);