Skip to content

Commit

Permalink
feat: improve title and body text
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jun 14, 2023
1 parent 8927bcb commit c9badb4
Showing 1 changed file with 44 additions and 17 deletions.
61 changes: 44 additions & 17 deletions pages/posts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,35 +264,61 @@
await loadNextPostPage()
}
const bodyTitle = computed(() => {
const title = computed(() => {
let title = ''
// Page
if (selectedPage.value !== selectedBooru.value.type.initialPageID) {
title += `Page ${selectedPage.value} of `
}
title += 'Posts'
// Tags
if (selectedTags.value.length > 0) {
title += ` Tagged ` + tagArrayToTitle(selectedTags.value)
title += ` tagged ${tagArrayToTitle(selectedTags.value)} porn`
}
// Filters
if (selectedFilters.value.rating) {
title += `, rated ${selectedFilters.value.rating}`
}
// TODO: Filters
if (selectedFilters.value.sort) {
title += `, sorted by ${selectedFilters.value.sort}`
}
if (selectedFilters.value.score) {
title += `, with a score of ${selectedFilters.value.score}`
}
// Domain
title += `, from ${selectedBooru.value.domain}`
title = title.trim()
title = capitalize(title)
return title.trim()
return title
})
useSeoMeta({
title: () => {
let title = ''
const titleForBody = computed(() => {
let _title = title.value
if (selectedTags.value.length > 0) {
title += ` ${tagArrayToTitle(selectedTags.value)}`
}
_title = _title.replace(/Page \d+ of /, '')
title += ` porn from ${selectedBooru.value.domain}`
_title = _title.replace(/posts /i, '')
// TODO: Filters
_title = _title.replace(/ porn/, '')
title = title.trim()
title = capitalize(title)
_title = _title.replace(/, from .+$/, '')
return title
},
_title = capitalize(_title)
return _title
})
useSeoMeta({
title,
description: () => {
let description = 'Stream and download porn images, GIFs and videos'
Expand Down Expand Up @@ -425,7 +451,8 @@
<h2 class="mb-3 truncate text-sm">
<!-- TODO: Make tags and filters clickable so they open search menu -->
{{ bodyTitle }}
{{ titleForBody }}
</h2>
<ol class="space-y-4">
Expand Down

0 comments on commit c9badb4

Please sign in to comment.