このコミットが含まれているのは:
+12
-8
@@ -23,6 +23,7 @@ import { prepareHelpPage } from '@/lib/help'
|
||||
import { fetchLocales, isLocaleCode, legacyLocalePath,
|
||||
switchLocalePath, unlocalisedPath } from '@/lib/locales'
|
||||
import { isAuthorityDependentQuery, localesKeys, sessionKeys } from '@/lib/queryKeys'
|
||||
import { isCountsPath } from '@/lib/routeLocales'
|
||||
import { switchPostFilterLocale } from '@/lib/posts'
|
||||
import { switchWikiLocale } from '@/lib/wiki'
|
||||
import { useLocale } from '@/lib/useLocale'
|
||||
@@ -199,19 +200,19 @@ export const pageRoutes = (
|
||||
handle: { locale: 'ja', sitemap: ['static'], preload: locale => locale === 'ja'
|
||||
? GekanatorPage.preload () : GekanatorUnavailablePage.preload () } },
|
||||
{ path: 'counts', element: <CountsResourcePage resource="posts"/>,
|
||||
handle: { preload: CountsResourcePage.preload } },
|
||||
handle: { preload: CountsResourcePage.preload, prefetch: false, robots: 'noindex' } },
|
||||
{ path: 'counts/posts', element: <CountsResourcePage resource="posts"/>,
|
||||
handle: { preload: CountsResourcePage.preload } },
|
||||
handle: { preload: CountsResourcePage.preload, prefetch: false, robots: 'noindex' } },
|
||||
{ path: 'counts/tags', element: <CountsResourcePage resource="tags"/>,
|
||||
handle: { preload: CountsResourcePage.preload } },
|
||||
handle: { preload: CountsResourcePage.preload, prefetch: false, robots: 'noindex' } },
|
||||
{ path: 'counts/nico_tags', element: <CountsResourcePage resource="nico_tags"/>,
|
||||
handle: { preload: CountsResourcePage.preload } },
|
||||
handle: { preload: CountsResourcePage.preload, prefetch: false, robots: 'noindex' } },
|
||||
{ path: 'counts/tag_descriptions', element: <CountsResourcePage resource="tag_descriptions"/>,
|
||||
handle: { preload: CountsResourcePage.preload } },
|
||||
handle: { preload: CountsResourcePage.preload, prefetch: false, robots: 'noindex' } },
|
||||
{ path: 'counts/tag_groups', element: <CountsResourcePage resource="tag_groups"/>,
|
||||
handle: { preload: CountsResourcePage.preload } },
|
||||
handle: { preload: CountsResourcePage.preload, prefetch: false, robots: 'noindex' } },
|
||||
{ path: 'counts/materials', element: <CountsResourcePage resource="materials"/>,
|
||||
handle: { preload: CountsResourcePage.preload } },
|
||||
handle: { preload: CountsResourcePage.preload, prefetch: false, robots: 'noindex' } },
|
||||
{ path: 'more', element: <MorePage/>,
|
||||
handle: { preload: MorePage.preload, sitemap: ['static'] } },
|
||||
{ path: '*', element: <NotFound/>, handle: { notFound: true } }]
|
||||
@@ -224,8 +225,11 @@ const matchPageRoutes = (pathname: string) =>
|
||||
export const preloadPageRoute = async (
|
||||
pathname: string,
|
||||
locale: LocaleCode,
|
||||
intent: 'navigation' | 'prefetch' = 'navigation',
|
||||
): Promise<void> => {
|
||||
if (intent === 'prefetch' && isCountsPath (pathname)) return
|
||||
await Promise.all ((matchPageRoutes (pathname) ?? [])
|
||||
.filter (match => intent === 'navigation' || match.route.handle?.prefetch !== false)
|
||||
.map (match => match.route.handle?.preload?.(locale)))
|
||||
}
|
||||
|
||||
@@ -262,7 +266,7 @@ const RoutedApp = ({ locales }: { locales: AvailableLocale[] }) => {
|
||||
const location = useLocation ()
|
||||
const locale = useLocale ()
|
||||
const route = resolvePageRoute (location.pathname)
|
||||
const robots = route?.route.handle?.robots
|
||||
const robots = isCountsPath (location.pathname) ? 'noindex' : route?.route.handle?.robots
|
||||
const pagePath = unlocalisedPath (location.pathname)
|
||||
const countsPage = pagePath === '/counts' || pagePath.startsWith ('/counts/')
|
||||
const switchLocale = async (targetLocale: LocaleCode): Promise<string> => {
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする