feat: prepare CMS pages for deployment
This commit is contained in:
@@ -4,12 +4,13 @@ import { revalidatePath } from 'next/cache'
|
||||
import { redirect } from 'next/navigation'
|
||||
|
||||
const CACHE_PATHS = [
|
||||
'/sitemap.xml',
|
||||
'/en',
|
||||
'/zh',
|
||||
'/en/about',
|
||||
'/zh/about',
|
||||
'/en/dealers',
|
||||
'/zh/dealers',
|
||||
'/en/where-to-buy',
|
||||
'/zh/where-to-buy',
|
||||
'/en/downloads',
|
||||
'/zh/downloads',
|
||||
'/en/news',
|
||||
@@ -54,3 +55,11 @@ export async function clearFrontendCache(formData: FormData) {
|
||||
|
||||
redirect(`${returnTo}${returnTo.includes('?') ? '&' : '?'}cache=cleared`)
|
||||
}
|
||||
|
||||
export async function refreshSitemapCache(formData: FormData) {
|
||||
const returnTo = normalizeReturnPath(formData.get('returnTo'))
|
||||
|
||||
revalidatePath('/sitemap.xml')
|
||||
|
||||
redirect(`${returnTo}${returnTo.includes('?') ? '&' : '?'}sitemap=refreshed`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user