From 4083bbf72eb2e37f3065ffcc18208050685c3478 Mon Sep 17 00:00:00 2001 From: Nathan Wang Date: Thu, 18 Jun 2020 10:08:18 -0700 Subject: [PATCH] add description field --- content/1_Intro/Data_Types.md | 1 + content/1_Intro/Getting_Started.md | 1 + src/templates/syllabusTemplate.js | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/content/1_Intro/Data_Types.md b/content/1_Intro/Data_Types.md index 268fd9c..7af4eb9 100644 --- a/content/1_Intro/Data_Types.md +++ b/content/1_Intro/Data_Types.md @@ -2,6 +2,7 @@ id: data-types title: Data Types author: Darren Yao +description: Learn about the basic data types needed for competitive programming. --- diff --git a/content/1_Intro/Getting_Started.md b/content/1_Intro/Getting_Started.md index 6b4a6ed..a138b2e 100644 --- a/content/1_Intro/Getting_Started.md +++ b/content/1_Intro/Getting_Started.md @@ -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. --- diff --git a/src/templates/syllabusTemplate.js b/src/templates/syllabusTemplate.js index cec0d59..0592e9c 100644 --- a/src/templates/syllabusTemplate.js +++ b/src/templates/syllabusTemplate.js @@ -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 ( + + {data.description} + + ); +}; export default function Template(props) { const data = props.data; @@ -160,6 +183,8 @@ export default function Template(props) { })} + + {module.map((x, idx) => renderModule(x, idx))} @@ -178,6 +203,7 @@ export const pageQuery = graphql` author problems prerequisites + description } } }