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 +);