Skip to content

Commit

Permalink
Merge pull request #299 from ocftw/fix/rearrange-page-order-in-naviga…
Browse files Browse the repository at this point in the history
…tionList

fix: fix page order in navigationList
  • Loading branch information
ben196888 authored Oct 31, 2023
2 parents 7d7392f + 00ac13e commit d7ceee0
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions homepage/_pages/en/cards.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
unique_slug: cards
name: Cards
page_order: 2
layout_list:
- type: layout_section
title: Talent, Event & Project Cards
Expand Down
1 change: 1 addition & 0 deletions homepage/_pages/en/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
unique_slug: index
name: Home
page_order: 1
layout_list:
- type: layout_banner
title: Open StarTer Village
Expand Down
1 change: 1 addition & 0 deletions homepage/_pages/en/resource.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
unique_slug: resource
name: Resource
page_order: 3
layout_list:
- type: layout_banner
hero_image: /images/uploads/img_3584_2.jpeg
Expand Down
1 change: 1 addition & 0 deletions homepage/_pages/zh-tw/cards.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
unique_slug: cards
name: 卡片頁
page_order: 2
layout_list:
- type: layout_section
title: 卡片介紹
Expand Down
1 change: 1 addition & 0 deletions homepage/_pages/zh-tw/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
unique_slug: index
name: 首頁
page_order: 1
layout_list:
- type: layout_banner
title: 開源星手村
Expand Down
1 change: 1 addition & 0 deletions homepage/_pages/zh-tw/resource.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
unique_slug: resource
name: 資源頁
page_order: 3
layout_list:
- type: layout_banner
hero_image: /images/uploads/img_3584_2.jpeg
Expand Down
4 changes: 3 additions & 1 deletion homepage/src/lib/getNavigationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export async function getPagesList(lang) {
return {
path: data.unique_slug,
name: data.name,
order: data.page_order,
};
});

Expand All @@ -33,10 +34,11 @@ export async function getNavigationList(lang) {
// * dynamic page navigation
const navigationList = pagesList
.filter((page) => page.path && page.name)
.sort((a, b) => a.order - b.order)
.map((page) => {
page.path = page.path.replace('index', '');
return { link: `/${page.path}`, text: page.name };
});
})

return navigationList;
}
3 changes: 3 additions & 0 deletions homepage/src/pages/admin/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"i18n": "duplicate"
},
{ "label": "Name", "name": "name", "widget": "string", "i18n": true },
{
"label": "Page order", "name": "page_order", "widget": "number", "value_type": "int", "i18n": "duplicate"
},
{
"label": "Layout & Content",
"name": "layout_list",
Expand Down

0 comments on commit d7ceee0

Please sign in to comment.