add description field

This commit is contained in:
Nathan Wang 2020-06-18 10:08:18 -07:00
parent 1f97f0adf0
commit 4083bbf72e
3 changed files with 28 additions and 0 deletions

View file

@ -2,6 +2,7 @@
id: data-types
title: Data Types
author: Darren Yao
description: Learn about the basic data types needed for competitive programming.
---
<module-excerpt>

View file

@ -2,6 +2,7 @@
id: getting-started
title: Getting Started
author: Nathan Wang, Benjamin Qi, Darren Yao
description: Welcome to the guide! Here we'll explain what a programming competition is, how it works, and how to choose a language.
---
<module-excerpt>

View file

@ -5,6 +5,29 @@ import SEO from "../components/seo"
import { graphql, Link } from "gatsby";
import { divisionLabels, divisions } from "../../content/ordering";
import { getModule } from "../utils";
import SyllabusModule from "../components/SyllabusModule";
const renderModule = (node, idx, parentIdx = -1) => {
if (node.hasOwnProperty("items")) {
return node.items.map((x, i) => renderModule(x, i, idx));
}
const data = node.frontmatter;
if (!data.title) return;
return (
<SyllabusModule
title={`${parentIdx !== -1 ? (parentIdx+1)+"." : ""}${idx+1}. ${data.title}`}
url={node.slug}
key={node.slug}
problems={data.problems}
prerequisites={data.prerequisites}
author={data.author}
>
{data.description}
</SyllabusModule>
);
};
export default function Template(props) {
const data = props.data;
@ -160,6 +183,8 @@ export default function Template(props) {
})}
</ol>
</div>
{module.map((x, idx) => renderModule(x, idx))}
</div>
</div>
</div>
@ -178,6 +203,7 @@ export const pageQuery = graphql`
author
problems
prerequisites
description
}
}
}