diff --git a/src/components/portfolio/project.svelte b/src/components/portfolio/project.svelte
new file mode 100644
index 0000000..aa285c4
--- /dev/null
+++ b/src/components/portfolio/project.svelte
@@ -0,0 +1,17 @@
+
+
+
+ {project.name}
+
+ {@html project.description}
+
+ {#if project.image}
+
+ {/if}
+
+
diff --git a/src/routes/portfolio/index.json.js b/src/routes/portfolio/index.json.js
index 4bd9510..cd1d31d 100644
--- a/src/routes/portfolio/index.json.js
+++ b/src/routes/portfolio/index.json.js
@@ -4,23 +4,26 @@ import fm from 'front-matter'
import marked from 'marked'
export async function get(req, res, next) {
- let pageSource
- try {
- console.log(process.cwd())
- pageSource = await promisify(readFile)('_pages/portfolio.md', 'utf-8')
- } catch (e) {
- res.statusCode = 500
- res.end('Error loading portfolio source file. \n' + e.toString())
- return
- }
-
- const parsed = fm(pageSource)
- console.log(parsed)
- const response = {
- title: parsed.attributes.title,
- content: marked(parsed.attributes.content),
- }
+ let pageSource
+ try {
+ pageSource = await promisify(readFile)('_pages/portfolio.md', 'utf-8')
+ } catch (e) {
+ res.statusCode = 500
+ res.end('Error loading portfolio source file. \n' + e.toString())
+ return
+ }
- res.setHeader('Content-Type', 'application/json')
- res.end(JSON.stringify(response))
+ const parsed = fm(pageSource)
+ const projects = (parsed.attributes.projects || []).map(project => ({
+ ...project,
+ description: marked(project.description)
+ }))
+ const response = {
+ title: parsed.attributes.title,
+ body: marked(parsed.body),
+ projects,
+ }
+
+ res.setHeader('Content-Type', 'application/json')
+ res.end(JSON.stringify(response))
}
\ No newline at end of file
diff --git a/src/routes/portfolio/index.svelte b/src/routes/portfolio/index.svelte
new file mode 100644
index 0000000..125efad
--- /dev/null
+++ b/src/routes/portfolio/index.svelte
@@ -0,0 +1,41 @@
+
+
+
+
+
+ {content.title}
+
+
+
Michal Vanko
+
+Software Developer
+
+
+
+
+
+
+ Projects
+
+ {#each content.projects as project}
+ -
+
+
+ {/each}
+
+
diff --git a/src/routes/portfolio/portfolio.svelte b/src/routes/portfolio/portfolio.svelte
deleted file mode 100644
index d6fc765..0000000
--- a/src/routes/portfolio/portfolio.svelte
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- Portfolio - Michal Vanko
-
-
-Michal Vanko
-
-Software Developer
-
-
-
-
-