on master help sign in
pages: specify sort
a86bba2Matilde Park
pages/blog.js+2−1
@@ -86,7 +86,8 @@ export default function Blog({ posts, search }) {
86export async function getStaticProps() {
86export async function getStaticProps() {
87 const posts = getAllPosts(
87 const posts = getAllPosts(
88 ["title", "slug", "date", "description", "extra"],
88 ["title", "slug", "date", "description", "extra"],
89− "blog"
89+ "blog",
90+ "date"
90 );
91 );
91
92
92 return {
93 return {
pages/blog/[slug].js+1−1
@@ -113,7 +113,7 @@ export async function getStaticProps({ params }) {
113}
113}
114
114
115export async function getStaticPaths() {
115export async function getStaticPaths() {
116− const posts = getAllPosts(["slug", "date"], "blog");
116+ const posts = getAllPosts(["slug", "date"], "blog", "date");
117
117
118 return {
118 return {
119 paths: posts.map((post) => {
119 paths: posts.map((post) => {
pages/events/[slug].js+1−1
@@ -169,7 +169,7 @@ export async function getStaticProps({ params }) {
169}
169}
170
170
171export async function getStaticPaths() {
171export async function getStaticPaths() {
172− const events = getAllPosts(["slug", "date"], "events");
172+ const events = getAllPosts(["slug", "date"], "events", "date");
173
173
174 return {
174 return {
175 paths: events.map((event) => {
175 paths: events.map((event) => {
pages/grants.js+2−6
@@ -463,12 +463,8 @@ export async function getStaticProps() {
463 const types = getGrantsTypes();
463 const types = getGrantsTypes();
464 const posts = getAllPosts(
464 const posts = getAllPosts(
465 ["title", "slug", "date", "description", "extra", "taxonomies"],
465 ["title", "slug", "date", "description", "extra", "taxonomies"],
466− "grants"
466+ "grants",
467− );
467+ "date"
468−
469− let updates = getAllPosts(
470− ["title", "slug", "date", "description", "extra", "taxonomies"],
471− "updates"
472 );
468 );
473
469
474 // The layout expects exactly 3
470 // The layout expects exactly 3
pages/grants/[slug].js+1−1
@@ -107,7 +107,7 @@ export async function getStaticProps({ params }) {
107}
107}
108
108
109export async function getStaticPaths() {
109export async function getStaticPaths() {
110− const posts = getAllPosts(["slug", "date"], "grants");
110+ const posts = getAllPosts(["slug", "date"], "grants", "date");
111
111
112 return {
112 return {
113 paths: posts.map((post) => {
113 paths: posts.map((post) => {
pages/index.js+2−1
@@ -284,7 +284,8 @@ export async function getStaticProps() {
284
284
285 const posts = getAllPosts(
285 const posts = getAllPosts(
286 ["title", "slug", "date", "description", "extra"],
286 ["title", "slug", "date", "description", "extra"],
287− "blog"
287+ "blog",
288+ "date"
288 );
289 );
289
290
290 const events = getAllEvents(eventKeys, "events");
291 const events = getAllEvents(eventKeys, "events");
pages/media.js+2−1
@@ -100,7 +100,8 @@ export default function Media({ posts, search }) {
100export async function getStaticProps() {
100export async function getStaticProps() {
101 const posts = getAllPosts(
101 const posts = getAllPosts(
102 ["title", "slug", "date", "description", "extra"],
102 ["title", "slug", "date", "description", "extra"],
103− "media"
103+ "media",
104+ "date"
104 );
105 );
105
106
106 return {
107 return {
pages/media/[slug].js+1−1
@@ -103,7 +103,7 @@ export async function getStaticProps({ params }) {
103}
103}
104
104
105export async function getStaticPaths() {
105export async function getStaticPaths() {
106− const posts = getAllPosts(["slug", "date"], "media");
106+ const posts = getAllPosts(["slug", "date"], "media", "date");
107
107
108 return {
108 return {
109 paths: posts.map((post) => {
109 paths: posts.map((post) => {
pages/updates.js+2−1
@@ -73,7 +73,8 @@ export default function Updates({ posts, search }) {
73export async function getStaticProps() {
73export async function getStaticProps() {
74 const posts = getAllPosts(
74 const posts = getAllPosts(
75 ["title", "slug", "date", "description", "extra"],
75 ["title", "slug", "date", "description", "extra"],
76− "updates"
76+ "updates",
77+ "date"
77 );
78 );
78
79
79 return {
80 return {
pages/updates/[slug].js+1−1
@@ -124,7 +124,7 @@ export async function getStaticProps({ params }) {
124}
124}
125
125
126export async function getStaticPaths() {
126export async function getStaticPaths() {
127− const posts = getAllPosts(["slug", "date"], "updates");
127+ const posts = getAllPosts(["slug", "date"], "updates", "date");
128
128
129 return {
129 return {
130 paths: posts.map((post) => {
130 paths: posts.map((post) => {