add new routing
This commit is contained in:
30
src/pages/news/[...slug].astro
Normal file
30
src/pages/news/[...slug].astro
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
import MainLayout from '@layouts/MainLayout.astro';
|
||||
import { getNodeByURI, getCategoryPosts } from '@lib/api/all';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
const { slug } = Astro.params;
|
||||
const uri = slug ? `/${slug}` : '/';
|
||||
|
||||
let response;
|
||||
let node = null;
|
||||
|
||||
try {
|
||||
response = await getNodeByURI(uri);
|
||||
node = response?.nodeByUri;
|
||||
} catch (error) {
|
||||
console.error('Error fetching node:', error);
|
||||
}
|
||||
|
||||
// ISR кэширование
|
||||
//Astro.response.headers.set(
|
||||
// 'Cache-Control',
|
||||
// 'public, s-maxage=3600, stale-while-revalidate=86400'
|
||||
//);
|
||||
---
|
||||
|
||||
News
|
||||
|
||||
<p>{uri}</p>
|
||||
|
||||
Reference in New Issue
Block a user