From 4a2c2a8587cab4982b8b73dee54c35fb8ed91aa5 Mon Sep 17 00:00:00 2001 From: "Henrik.Askjer" <henrik.askjer@uib.no> Date: Wed, 2 Feb 2022 11:01:05 +0000 Subject: [PATCH] SEO --- .gitlab-ci.yml | 2 ++ public/index.html | 1 - public/robots.txt | 3 +-- src/components/DictionaryView.vue | 27 ++++++++++++++------------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd21e3b6..241c38de 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,7 @@ build-dev: fi - npm install --progress=false - npm run build -- --mode dev_server + - 'echo -e "\nDisallow: /" >> dist/robots.txt' artifacts: expire_in: 1 week paths: @@ -46,6 +47,7 @@ build-prod: - echo "VUE_APP_RELEASE=$CI_COMMIT_REF_NAME" >> .env.production - npm install --progress=false - npm run build -- --mode production + - 'echo -e "\nAllow: /" >> dist/robots.txt' artifacts: expire_in: 1 week paths: diff --git a/public/index.html b/public/index.html index 04ae7af2..b7dfc1be 100644 --- a/public/index.html +++ b/public/index.html @@ -6,7 +6,6 @@ <meta name="viewport" content="width=device-width,initial-scale=1.0"> <link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="apple-touch-icon" href="<%= BASE_URL %>touch-icon.png"> - <meta name="robots" content="noindex" /> <meta property="og:title" content="Ordbøkene.no - Bokmålsordboka og Nynorskordboka" /> <meta property="twitter:title" content="Ordbøkene.no - Bokmålsordboka og Nynorskordboka" /> <meta property="og:type" content="website" /> diff --git a/public/robots.txt b/public/robots.txt index b4d2b278..caf3ca8d 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,4 +1,3 @@ # Disable search engine indexing -User-agent: * -Disallow: / \ No newline at end of file +User-agent: * \ No newline at end of file diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index 53d0f53f..407b93d9 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -393,20 +393,21 @@ export default { } }, metaInfo() { + let q = "" if (this.$route.query.q) { - return {title: this.$route.query.q+" - Ordbøkene"} + q = this.$route.query.q + " - " } - else { - let desc = " viser skrivemåte og bøying i tråd med norsk rettskriving. Språkrådet og Universitetet i Bergen står bak ordbøkene." - switch (this.lang) { - case 'bm,nn': return {title: 'ordbøkene.no', - meta: [{name: "description", vmid: 'description', content: "Bokmålsordboka og Nynorskordboka"+desc}]} - case 'bm': return {title: "Bokmålsordboka", - meta: [{name: "description", vmid: 'description', content: "Bokmålsordboka"+desc}]} - case 'nn': return {title: "Nynorskordboka", - meta: [{name: "description", vmid: 'description', content: "Nynorskordboka"+desc}] } - } + let desc = " viser skrivemåte og bøying i tråd med norsk rettskriving. Språkrådet og Universitetet i Bergen står bak ordbøkene." + switch (this.lang) { + case 'bm,nn': return {title: q+'ordbøkene.no', + meta: [{name: "description", vmid: 'description', content: "Bokmålsordboka og Nynorskordboka"+desc}]} + case 'bm': return {title: q+"Bokmålsordboka", + meta: [{name: "description", vmid: 'description', content: "Bokmålsordboka"+desc}]} + case 'nn': return {title: q+"Nynorskordboka", + meta: [{name: "description", vmid: 'description', content: "Nynorskordboka"+desc}] } } + + }, components: { Article, @@ -564,7 +565,7 @@ export default { self.update_page() } */ - + } ).then(() => { this.$store.commit('setSearchRoute', this.$route.fullPath) @@ -578,7 +579,7 @@ export default { generate_lang_path: function(dict) { return this.$route.fullPath.replace(/\/(bm|nn|bm,nn)\//, "/"+dict+"/") - + }, reload_params: function() { -- GitLab