Skip to content

Commit fe923a6

Browse files
committed
Improve SEO for CVE Record Detail page; noindex on test website
1 parent 7366730 commit fe923a6

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/App.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import PrimaryNavigation from './components/PrimaryNavigation.vue';
1919
import NotificationBannerModule from './components/NotificationBannerModule.vue';
2020
import FooterModule from './components/FooterModule.vue';
2121
import NotFound from './views/NotFound.vue';
22+
import { useGenericGlobalsStore } from './stores/genericGlobals';
2223
import { useSeoMeta } from '@unhead/vue';
2324
2425
export default {
@@ -42,6 +43,20 @@ export default {
4243
});
4344
},
4445
head() {
46+
47+
const isProductionSite = useGenericGlobalsStore().isProductionWebsite;
48+
49+
if (!isProductionSite) {
50+
51+
// Particularly for the test CVE website (test.cve.org), prevent
52+
// any search engine from crawling the content. This should only
53+
// be allowed for the production website.
54+
55+
return {
56+
meta: [{name: 'robots', content: 'noindex, nofollow'}]
57+
}
58+
}
59+
4560
// Remove any trailing and leading slashes on the base URL and
4661
// path suffix so we know what we're dealing with and we control
4762
// the slash separating the two components.
@@ -50,8 +65,7 @@ export default {
5065
const suffix = this.$route.fullPath.replace(/^\/+/, '');
5166
5267
return {
53-
link: [{rel: 'canonical',
54-
content: `${baseURL}/${suffix}`}]
68+
link: [{rel: 'canonical', href: `${baseURL}/${suffix}`}]
5569
}
5670
}
5771
}

src/views/CVERecord/CVERecord.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ export default {
138138
},
139139
head() {
140140
const cveId = this.$route.query.id;
141-
return {title: `CVE Record: ${cveId}`}
141+
return {
142+
title: `CVE Record: ${cveId}`,
143+
meta: [{
144+
name: 'description',
145+
content: `Vulnerability detail for ${cveId}`}]
146+
}
142147
},
143148
watch: {
144149
$route(to) {

0 commit comments

Comments
 (0)