Update page title to include model name (#2587)
This commit is contained in:
committed by
GitHub
parent
455b21cba3
commit
cd73a7aad8
@@ -17,7 +17,7 @@ const { isDarkTheme } = useTheme()
|
||||
|
||||
useHead({
|
||||
// Title suffix
|
||||
titleTemplate: (titleChunk) => (titleChunk ? `${titleChunk} - Speckle` : 'Speckle'),
|
||||
titleTemplate: (titleChunk) => (titleChunk ? `${titleChunk} | Speckle` : 'Speckle'),
|
||||
htmlAttrs: {
|
||||
class: computed(() => (isDarkTheme.value ? `dark` : ``)),
|
||||
lang: 'en'
|
||||
|
||||
@@ -137,9 +137,20 @@ graphql(`
|
||||
}
|
||||
`)
|
||||
|
||||
const title = computed(() =>
|
||||
project.value?.name.length ? `Viewer - ${project.value.name}` : ''
|
||||
)
|
||||
const title = computed(() => {
|
||||
if (project.value?.models?.items) {
|
||||
const modelCount = project.value.models.items.length
|
||||
const projectName = project.value.name || ''
|
||||
|
||||
if (modelCount > 1) {
|
||||
return projectName ? `Multiple models - ${projectName}` : 'Multiple models'
|
||||
} else if (modelCount === 1) {
|
||||
const modelName = project.value.models.items[0].name || ''
|
||||
return projectName ? `${modelName} - ${projectName}` : modelName
|
||||
}
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
const modelName = computed(() => {
|
||||
if (project.value?.models?.items && project.value.models.items.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user