Added blog page, article page and added latest articles to start page.

This commit is contained in:
2020-06-14 02:16:39 +02:00
parent 71ca09427f
commit da2bc2ef28
11 changed files with 325 additions and 57 deletions

View File

@@ -19,9 +19,13 @@
</section>
<section>
<h2>latest blog posts</h2>
<p>
TODO
</p>
{{range $article := .Articles}}
<p>
<a href="/blog/{{slug $article.LatestArticleContent.Title}}-{{$article.Id}}">{{$article.LatestArticleContent.Title}}</a>
</p>
{{else}}
<p>There are no blog posts yet...</p>
{{end}}
<p>
<a href="/blog">View all</a>
</p>

10
template/article.html Normal file
View File

@@ -0,0 +1,10 @@
{{template "head.html"}}
{{template "menu.html"}}
<section>
<h1>{{.Title}}</h1>
<small>Published on {{.Published}}</small>
{{.Content}}
</section>
{{template "end.html"}}

View File

@@ -2,7 +2,18 @@
{{template "menu.html"}}
<section>
<p>TODO Blog</p>
<h1>Blog</h1>
{{range $year, $articles := .Articles}}
<h2>{{$year}}</h2>
{{range $article := $articles}}
<p>
<a href="/blog/{{slug $article.LatestArticleContent.Title}}-{{$article.Id}}">{{$article.LatestArticleContent.Title}}</a>
</p>
{{end}}
{{else}}
<p>There are no blog posts yet...</p>
{{end}}
</section>
{{template "end.html"}}

View File

@@ -5,7 +5,7 @@
<h2>Page not found</h2>
<p>
Nothing to see here...<br />
<a href="/">Go back Home</a>
<a href="/">Return home</a>
</p>
</section>