-
-
-
-
- WBSC Scoring Creator
-
-
-
-
-
+
+
+
+
+
+ WBSC Scoring Creator
+
+
+
+
+
+
-
-
-
+
@@ -43,6 +43,15 @@ useHead({
},
})
+const title = ref(getPageTitle(useRoute().path))
+usePageMeta({
+ ...WBSC_PAGE_META,
+ title,
+})
+useRouter().beforeEach((to) => {
+ title.value = getPageTitle(to.path)
+})
+
function toIndex() {
return navigateTo('/')
}
diff --git a/composables/usePageMeta.ts b/composables/usePageMeta.ts
index 0836c69..6bc2902 100644
--- a/composables/usePageMeta.ts
+++ b/composables/usePageMeta.ts
@@ -5,9 +5,9 @@ export const WBSC_DSCR = 'Visualization of WBSC baseball/softball scoring system
export type MetaDef = {
type?: 'website' | 'article'
- url?: string
- title?: string
- dscr?: string
+ url?: string | Ref
+ title?: string | Ref
+ dscr?: string | Ref
}
export const WBSC_PAGE_META: MetaDef = {
@@ -29,3 +29,17 @@ export function usePageMeta(meta: MetaDef) {
twitterCard: 'summary_large_image',
})
}
+
+export function getPageTitle(route: string) {
+ const title = WBSC_TITLE
+ switch (route) {
+ case '/help':
+ return title + ' - Help'
+ case '/project':
+ return title + ' - Project'
+ case '/report':
+ return title + ' - Report'
+ default:
+ return title
+ }
+}
diff --git a/pages/help.vue b/pages/help.vue
index f279797..688eada 100644
--- a/pages/help.vue
+++ b/pages/help.vue
@@ -4,10 +4,3 @@