diff --git a/src/generateHTMLPages.js b/src/generateHTMLPages.js index c495d22..def58e5 100644 --- a/src/generateHTMLPages.js +++ b/src/generateHTMLPages.js @@ -9,10 +9,11 @@ const initialize = async () => { } const generateIndexPage = async jsonData => { + let sortedData = jsonData.sort((prev, cur) => new Date(prev.updatedAt) < new Date(cur.updatedAt)); const indexTemplate = await getTemplate('index'); try { - return outputFile(join(distPath, 'index') + '.html', indexTemplate(jsonData)); + return outputFile(join(distPath, 'index') + '.html', indexTemplate(sortedData)); } catch (error) { console.error('Error while writing index html file', error); return; diff --git a/src/pages/code2college.json b/src/pages/code2college.json index 3f3a89d..30301a4 100644 --- a/src/pages/code2college.json +++ b/src/pages/code2college.json @@ -1,6 +1,7 @@ { "name": "Code2College", "description": "Curriculum development and interview prep.", + "updatedAt": "2018-12-10T00:00:00Z", "pageType": "volunteer", "repositoryTopics": { "edges": [ diff --git a/src/pages/finx.json b/src/pages/finx.json index 6058491..b5415f6 100644 --- a/src/pages/finx.json +++ b/src/pages/finx.json @@ -1,6 +1,7 @@ { "name": "Innovating in FinX", "description": "Stronger communities w/ better financial tools.", + "updatedAt": "2019-01-30T00:00:00Z", "pageType": "work-history", "repositoryTopics": { "edges": [ diff --git a/src/pages/nonprofits.json b/src/pages/nonprofits.json index a275256..7fbeda0 100644 --- a/src/pages/nonprofits.json +++ b/src/pages/nonprofits.json @@ -1,6 +1,7 @@ { "name": "Austin Give Camp", "description": "Pro-bono web dev for good.", + "updatedAt": "2016-10-04", "pageType": "volunteer", "repositoryTopics": { "edges": [ diff --git a/src/pages/patienteducation.json b/src/pages/patienteducation.json index c4ceccf..8667d1b 100644 --- a/src/pages/patienteducation.json +++ b/src/pages/patienteducation.json @@ -1,6 +1,7 @@ { "name": "Patient Education", "description": "Empowering doctors to educate through tech.", + "updatedAt": "2015-12-30T00:00:00Z", "pageType": "work-history", "repositoryTopics": { "edges": [ diff --git a/src/schema.js b/src/schema.js index 148fdb4..cd0c14c 100644 --- a/src/schema.js +++ b/src/schema.js @@ -6,6 +6,7 @@ module.exports = `{ name description url + updatedAt repositoryTopics(last: 5) { edges { node {