Skip to content

Commit

Permalink
fix: incorrect activity title
Browse files Browse the repository at this point in the history
  • Loading branch information
djdjz7 committed Dec 25, 2024
1 parent d272986 commit 1e1d1c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ img {
}

@media (prefers-color-scheme: dark) {
body {
}
.shiki,
.shiki span {
color: var(--shiki-dark) !important;
Expand Down
14 changes: 7 additions & 7 deletions src/views/PageView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ const allPages = [...newsList, ...activityList]
const pageModuleCategories = [newsModules, activityModules]
const route = useRoute(() => scrollViewRef.value?.scrollTop)
const pathname = getPathname(route.path)
const pageCategory = getPageCategory(pathname)
const pageCategory = ref(getPageCategory(pathname))
const currentPage = shallowRef(getCurrentPage(pathname))
const title = useTitle('', { titleTemplate: '%s北京大学学生 Linux 俱乐部' })
title.value = currentPage.value?.title
? currentPage.value.title + ` | ${pageCategory} - `
: `${pageCategory} - `
? currentPage.value.title + ` | ${pageCategory.value} - `
: `${pageCategory.value} - `
if (ssrContext) {
ssrContext.titlePrefix = title.value
ssrContext.metaDescription = (
Expand All @@ -67,11 +67,11 @@ watch(
() => route.path,
async (newVal) => {
const pathname = getPathname(newVal)
const pageCategory = getPageCategory(pathname)
pageCategory.value = getPageCategory(pathname)
currentPage.value = getCurrentPage(pathname)
title.value = currentPage.value?.title
? currentPage.value.title + ` | ${pageCategory} - `
: `${pageCategory} - `
? currentPage.value.title + ` | ${pageCategory.value} - `
: `${pageCategory.value} - `
Content.value = LoadingView as never
const module = await resolvePageModule(pathname)
if ('default' in module) Content.value = module.default
Expand Down Expand Up @@ -151,7 +151,7 @@ function getPageCategory(pathname: string): string {
>
<TopbarComponent
:toggleSidebarFn="sidebarRef?.toggleSidebar"
:title="currentPage?.title ?? '新闻'"
:title="currentPage?.title ?? pageCategory"
:show-title="showTitle"
/>
<div v-if="currentPage" m-b-8 max-w-800px m-x-auto m-t-4 lg:m-t-0>
Expand Down

0 comments on commit 1e1d1c1

Please sign in to comment.