Skip to content

Commit

Permalink
feat: add navigation list to resource page
Browse files Browse the repository at this point in the history
  • Loading branch information
ljc1991 authored and ben196888 committed Sep 20, 2023
1 parent 452fa52 commit 1bf0f66
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions homepage/src/pages/resource.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,42 @@ import { fetchPage } from '../lib/fetchPage';
export const getStaticProps = async ({ locale }) => {
const page = fetchPage(locale, 'resource');

const homepage = {
en: 'Home',
'zh-tw': '首頁',
};

const cardsPage = {
en: 'Cards',
'zh-tw': '卡片頁',
};

const activitiesPage = {
en: 'Activities',
'zh-tw': '活動頁',
};

// site page navigation
const navigationList = [
{ link: `/cards`, text: cardsPage[locale] },
{ link: `/activities`, text: activitiesPage[locale] },
{ link: `/`, text: homepage[locale] },
];

/*
// content navigation
const navigationList = page.data['layout_list']?.map((layout) => {
return {
text: layout?.title,
link: `#${layout?.title}`,
};
});
*/

return {
props: {
page,
navigationList,
},
};
};
Expand Down

0 comments on commit 1bf0f66

Please sign in to comment.