Skip to content

Commit

Permalink
feat: add canonical tag
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Aug 1, 2022
1 parent e3e408b commit 9e81ba0
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ import { mapActions, mapGetters } from 'vuex'
// Mixins
import FetchPostsMixin from '~/components/pages/posts/post/FetchPostsMixin.js'
import { SeoHelper } from "~/assets/js/SeoHelper";
import { RouterHelper } from '~/assets/js/RouterHelper'
import { SeoHelper } from '~/assets/js/SeoHelper'
export default {
mixins: [FetchPostsMixin],
Expand All @@ -69,7 +70,7 @@ export default {
data() {
return {
searchResults: [],
searchResults: []
}
},
Expand All @@ -80,21 +81,33 @@ export default {
{
hid: 'referrer',
name: 'referrer',
content: 'no-referrer',
},
content: 'no-referrer'
}
],
link: []
}
// Join array of tags into a comma separated string
const tags = SeoHelper.tagArrayToTitle(this.getTags)
if (tags) {
// Title
head.title = tags + ' Hentai Porn'
// Description
head.meta.push({
hid: 'description',
name: 'description',
content: `Browse popular ${ tags } Rule 34 Hentai Porn for free. Without ads.`,
content: `Browse popular ${ tags } Rule 34 Hentai Porn for free. Without ads.`
})
// Canonical
const CANONICAL_ROUTE = RouterHelper.generatePostsRouteWithDefaults(this.$nuxt.$store, undefined, undefined, this.getTags)
head.link.push({
hid: 'canonical',
name: 'canonical',
content: this.$router.resolve(CANONICAL_ROUTE).href
})
}
Expand All @@ -109,7 +122,7 @@ export default {
'getPremiumBooruList',
'getPosts',
'getPageID',
'getTags',
'getTags'
]),
...mapGetters('premium', ['isUserPremium']),
Expand All @@ -123,7 +136,7 @@ export default {
const DEFAULT_BOORU_GROUP = {
name: 'Default',
domains: DOMAINS_FROM_DEFAULT_BOORU_LIST,
domains: DOMAINS_FROM_DEFAULT_BOORU_LIST
}
BOORU_GROUP_LIST.push(DEFAULT_BOORU_GROUP)
Expand All @@ -135,28 +148,28 @@ export default {
const PREMIUM_BOORU_GROUP = {
name: 'Custom',
domains: ['<Add Booru>'],
domains: ['<Add Booru>']
}
if (this.isUserPremium) {
PREMIUM_BOORU_GROUP.domains = [
...DOMAINS_FROM_PREMIUM_BOORU_LIST,
...PREMIUM_BOORU_GROUP.domains,
...PREMIUM_BOORU_GROUP.domains
]
}
BOORU_GROUP_LIST.push(PREMIUM_BOORU_GROUP)
return BOORU_GROUP_LIST
},
}
},
methods: {
...mapActions('booru', [
'activeBooruManager',
'pidManager',
'tagsManager',
'fetchTags',
'fetchTags'
]),
async onDomainChange(domain) {
Expand Down Expand Up @@ -192,7 +205,7 @@ export default {
async onSubmitActiveTags(tags) {
await this.tagsManager({ operation: 'set', value: tags })
},
},
}
}
}
</script>

0 comments on commit 9e81ba0

Please sign in to comment.