Index sort by updatedAt
This commit is contained in:
parent
03698bf7e3
commit
e1537095c4
6 changed files with 7 additions and 1 deletions
|
@ -9,10 +9,11 @@ const initialize = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateIndexPage = async jsonData => {
|
const generateIndexPage = async jsonData => {
|
||||||
|
let sortedData = jsonData.sort((prev, cur) => new Date(prev.updatedAt) < new Date(cur.updatedAt));
|
||||||
const indexTemplate = await getTemplate('index');
|
const indexTemplate = await getTemplate('index');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return outputFile(join(distPath, 'index') + '.html', indexTemplate(jsonData));
|
return outputFile(join(distPath, 'index') + '.html', indexTemplate(sortedData));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error while writing index html file', error);
|
console.error('Error while writing index html file', error);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Code2College",
|
"name": "Code2College",
|
||||||
"description": "Curriculum development and interview prep.",
|
"description": "Curriculum development and interview prep.",
|
||||||
|
"updatedAt": "2018-12-10T00:00:00Z",
|
||||||
"pageType": "volunteer",
|
"pageType": "volunteer",
|
||||||
"repositoryTopics": {
|
"repositoryTopics": {
|
||||||
"edges": [
|
"edges": [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Innovating in FinX",
|
"name": "Innovating in FinX",
|
||||||
"description": "Stronger communities w/ better financial tools.",
|
"description": "Stronger communities w/ better financial tools.",
|
||||||
|
"updatedAt": "2019-01-30T00:00:00Z",
|
||||||
"pageType": "work-history",
|
"pageType": "work-history",
|
||||||
"repositoryTopics": {
|
"repositoryTopics": {
|
||||||
"edges": [
|
"edges": [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Austin Give Camp",
|
"name": "Austin Give Camp",
|
||||||
"description": "Pro-bono web dev for good.",
|
"description": "Pro-bono web dev for good.",
|
||||||
|
"updatedAt": "2016-10-04",
|
||||||
"pageType": "volunteer",
|
"pageType": "volunteer",
|
||||||
"repositoryTopics": {
|
"repositoryTopics": {
|
||||||
"edges": [
|
"edges": [
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "Patient Education",
|
"name": "Patient Education",
|
||||||
"description": "Empowering doctors to educate through tech.",
|
"description": "Empowering doctors to educate through tech.",
|
||||||
|
"updatedAt": "2015-12-30T00:00:00Z",
|
||||||
"pageType": "work-history",
|
"pageType": "work-history",
|
||||||
"repositoryTopics": {
|
"repositoryTopics": {
|
||||||
"edges": [
|
"edges": [
|
||||||
|
|
|
@ -6,6 +6,7 @@ module.exports = `{
|
||||||
name
|
name
|
||||||
description
|
description
|
||||||
url
|
url
|
||||||
|
updatedAt
|
||||||
repositoryTopics(last: 5) {
|
repositoryTopics(last: 5) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
|
Loading…
Add table
Reference in a new issue