Skip to content

Commit 700e344

Browse files
committed
Improve SEO presence
1 parent 7f31cf9 commit 700e344

File tree

14 files changed

+167
-22
lines changed

14 files changed

+167
-22
lines changed

app/app.vue

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,53 @@ import { computed } from 'vue'
33
import { useLastSeenTracking } from '@/lib/lastSeen'
44
55
const route = useRoute()
6+
7+
const site = useSiteConfig()
8+
const canonicalUrl = useCanonicalUrl()
9+
10+
useHead(() => ({
11+
title: site.name,
12+
titleTemplate: (titleChunk?: string) => {
13+
if (titleChunk)
14+
return titleChunk === site.name || titleChunk.includes(`| ${site.name}`) ? titleChunk : `${titleChunk} | ${site.name}`
15+
return site.name
16+
},
17+
htmlAttrs: {
18+
lang: 'en',
19+
},
20+
link: [
21+
{ rel: 'canonical', href: canonicalUrl.value },
22+
],
23+
script: [
24+
{
25+
type: 'application/ld+json',
26+
children: JSON.stringify({
27+
'@context': 'https://schema.org',
28+
'@type': 'WebSite',
29+
'name': site.name,
30+
'url': site.url,
31+
}),
32+
},
33+
{
34+
type: 'application/ld+json',
35+
children: JSON.stringify({
36+
'@context': 'https://schema.org',
37+
'@type': 'Organization',
38+
'name': site.name,
39+
'url': site.url,
40+
'logo': new URL('/logo.svg', site.url).toString(),
41+
}),
42+
},
43+
],
44+
}))
45+
46+
useSeoMeta({
47+
description: site.description,
48+
ogSiteName: site.name,
49+
ogUrl: canonicalUrl,
50+
ogType: 'website',
51+
twitterCard: 'summary_large_image',
52+
})
653
const layoutName = computed(() => {
754
if (route.path.startsWith('/admin'))
855
return 'admin'

app/composables/useCanonicalUrl.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { computed } from 'vue'
2+
3+
export function useCanonicalUrl() {
4+
const route = useRoute()
5+
const runtimeConfig = useRuntimeConfig()
6+
7+
return computed(() => {
8+
const baseUrl = runtimeConfig.public.baseUrl || 'https://hivecom.net'
9+
return new URL(route.path, baseUrl).toString()
10+
})
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default defineNuxtRouteMiddleware((to) => {
2+
const noindexPrefixes = ['/admin', '/auth', '/playground', '/profile', '/votes']
3+
const shouldNoindex = noindexPrefixes.some(prefix => to.path === prefix || to.path.startsWith(`${prefix}/`))
4+
5+
if (!shouldNoindex)
6+
return
7+
8+
useSeoMeta({
9+
robots: 'noindex, nofollow',
10+
})
11+
})

app/pages/announcements/index.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,11 @@ function clearFilters() {
115115
116116
// SEO and page metadata
117117
useSeoMeta({
118-
title: 'Announcements | Hivecom',
118+
title: 'Announcements',
119119
description: 'Stay up to date with the latest announcements and news from Hivecom.',
120-
ogTitle: 'Announcements | Hivecom',
120+
ogTitle: 'Announcements',
121121
ogDescription: 'Stay up to date with the latest announcements and news from Hivecom.',
122122
})
123-
124-
// Page title
125-
useHead({
126-
title: 'Announcements',
127-
})
128123
</script>
129124

130125
<template>

app/pages/community/badges.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ const membershipSnapshots = [1, 5, 10, 20].map(years => ({
1919
years,
2020
memberSince: memberSinceYearsAgo(years),
2121
}))
22+
23+
useSeoMeta({
24+
title: 'Badges',
25+
description: 'Explore the badges available in the Hivecom community.',
26+
ogTitle: 'Badges',
27+
ogDescription: 'Explore the badges available in the Hivecom community.',
28+
})
2229
</script>
2330

2431
<template>

app/pages/community/funding.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ const supporters = ref<string[]>([])
2222
// UI state
2323
const showPastExpenses = ref(false)
2424
25+
useSeoMeta({
26+
title: 'Funding',
27+
description: 'See Hivecom community funding, expenses, and how to support the project.',
28+
ogTitle: 'Funding',
29+
ogDescription: 'See Hivecom community funding, expenses, and how to support the project.',
30+
})
31+
2532
// Fetch data on mount
2633
onMounted(async () => {
2734
loading.value = true

app/pages/community/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ const activeTab = ref<'about' | 'voice'>('about')
1515
const route = useRoute()
1616
const router = useRouter()
1717
18+
useSeoMeta({
19+
title: 'Community',
20+
description: 'Learn about Hivecom, explore community projects, and connect with members.',
21+
ogTitle: 'Community',
22+
ogDescription: 'Learn about Hivecom, explore community projects, and connect with members.',
23+
})
24+
1825
const queryTab = computed(() => {
1926
const tab = route.query.tab ?? (route.query.voice ? 'voice' : undefined)
2027
return Array.isArray(tab) ? tab[0] : tab

app/pages/community/projects/index.vue

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,11 @@ onMounted(() => {
102102
103103
// SEO and page metadata
104104
useSeoMeta({
105-
title: 'Community Projects | Hivecom',
105+
title: 'Community Projects',
106106
description: 'Explore community projects and initiatives from the Hivecom community.',
107-
ogTitle: 'Community Projects | Hivecom',
107+
ogTitle: 'Community Projects',
108108
ogDescription: 'Explore community projects and initiatives from the Hivecom community.',
109109
})
110-
111-
// Page title
112-
useHead({
113-
title: 'Community Projects',
114-
})
115110
</script>
116111

117112
<template>

app/pages/events/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ const loading = ref(true)
4040
const errorMessage = ref('')
4141
const events = ref<Tables<'events'>[]>()
4242
43+
useSeoMeta({
44+
title: 'Events',
45+
description: 'Discover upcoming, ongoing, and past events in the Hivecom community.',
46+
ogTitle: 'Events',
47+
ogDescription: 'Discover upcoming, ongoing, and past events in the Hivecom community.',
48+
})
49+
4350
onMounted(async () => {
4451
loading.value = true
4552

app/pages/gameservers/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ const games = ref<Tables<'games'>[]>()
6666
const gameservers = ref<GameserversType>()
6767
const supportModalOpen = ref(false)
6868
69+
useSeoMeta({
70+
title: 'Game Servers',
71+
description: 'Browse the Hivecom game server library and live server listings.',
72+
ogTitle: 'Game Servers',
73+
ogDescription: 'Browse the Hivecom game server library and live server listings.',
74+
})
75+
6976
onBeforeMount(async () => {
7077
// Make our requests at the same time.
7178
const requests = [

0 commit comments

Comments
 (0)