diff --git a/src/components/portfolio/work.svelte b/src/components/portfolio/work.svelte new file mode 100644 index 0000000..3838fa5 --- /dev/null +++ b/src/components/portfolio/work.svelte @@ -0,0 +1,10 @@ + + +
+

{work.name}

+
+ {@html work.description} +
+
\ No newline at end of file diff --git a/src/routes/portfolio/index.json.js b/src/routes/portfolio/index.json.js index cd1d31d..9b7b3f6 100644 --- a/src/routes/portfolio/index.json.js +++ b/src/routes/portfolio/index.json.js @@ -14,16 +14,30 @@ export async function get(req, res, next) { } const parsed = fm(pageSource) - const projects = (parsed.attributes.projects || []).map(project => ({ - ...project, - description: marked(project.description) - })) + const workHistory = (parsed.attributes.work_history || []).map(parseField('description')) + const projects = (parsed.attributes.projects || []) + .filter(project => project.displayed) + .map(parseField('description')) + const education = (parsed.attributes.education || []) + .filter(education => education.displayed) + .map(parseField('description')) + const response = { title: parsed.attributes.title, body: marked(parsed.body), + workHistoryPrelude: marked(parsed.attributes.work_history_prelude), + workHistory, projects, + education, } res.setHeader('Content-Type', 'application/json') res.end(JSON.stringify(response)) +} + +function parseField(field) { + return item => ({ + ...item, + [field]: marked(item[field]) + }) } \ No newline at end of file diff --git a/src/routes/portfolio/index.svelte b/src/routes/portfolio/index.svelte index 125efad..224584e 100644 --- a/src/routes/portfolio/index.svelte +++ b/src/routes/portfolio/index.svelte @@ -9,7 +9,7 @@