-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SEO properties to collection pages (#3999)
* Add SEO properties to collection pages Signed-off-by: Olga Bulat <obulat@gmail.com> * Update frontend/src/locales/scripts/en.json5 Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu> * Add suggestions from code review use-collection-meta.ts is refactored to add a static " | Openverse" string to the title to prevent confusion with pluralized i18n strings Signed-off-by: Olga Bulat <obulat@gmail.com> * Add suggestions from code review Add suggestions from code review Update the strings: add comment that the phrases will be used for page titles Signed-off-by: Olga Bulat <obulat@gmail.com> * Fix types Signed-off-by: Olga Bulat <obulat@gmail.com> * Simplify Signed-off-by: Olga Bulat <obulat@gmail.com> * Replace docker-compose with docker compose for playwright Signed-off-by: Olga Bulat <obulat@gmail.com> --------- Signed-off-by: Olga Bulat <obulat@gmail.com> Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
- Loading branch information
1 parent
7b5d401
commit 213c886
Showing
8 changed files
with
133 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { computed } from "vue" | ||
|
||
import { useI18n } from "~/composables/use-i18n" | ||
import { useProviderStore } from "~/stores/provider" | ||
import type { SupportedMediaType } from "~/constants/media" | ||
import type { CollectionParams } from "~/types/search" | ||
|
||
import type { ComputedRef } from "vue" | ||
|
||
export const useCollectionMeta = ({ | ||
collectionParams, | ||
mediaType, | ||
i18n, | ||
}: { | ||
collectionParams: ComputedRef<CollectionParams | null> | ||
mediaType: SupportedMediaType | ||
i18n: ReturnType<typeof useI18n> | ||
}) => { | ||
const pageTitle = computed(() => { | ||
const params = collectionParams.value | ||
|
||
if (params) { | ||
if (params.collection === "creator") { | ||
return `${params.creator} | Openverse` | ||
} | ||
|
||
if (params.collection === "source") { | ||
const sourceName = useProviderStore().getProviderName( | ||
params.source, | ||
mediaType | ||
) | ||
return `${i18n.t(`collection.pageTitle.source.${mediaType}`, { source: sourceName })} | Openverse` | ||
} | ||
|
||
if (params.collection === "tag") { | ||
return `${i18n.t(`collection.pageTitle.tag.${mediaType}`, { tag: params.tag })} | Openverse` | ||
} | ||
} | ||
|
||
return "Openly Licensed Images, Audio and More | Openverse" | ||
}) | ||
|
||
return { | ||
pageTitle, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 0 additions & 48 deletions
48
frontend/test/unit/specs/utils/validate-collection-params.spec.js
This file was deleted.
Oops, something went wrong.