Browse Source

Added list support with categories to theme

* Updated site index
* Added a portfolio page
* Added a category support within listing pages
* Added some weighting to the page links
master
Drew Short 5 years ago
parent
commit
f711d2c555
  1. 1
      content/about.md
  2. 0
      content/index.md
  3. 6
      content/portfolio/_index.md
  4. 5
      content/portfolio/sothr-dot-com-website.md
  5. 42
      themes/pure/layouts/_default/list.html
  6. 2
      themes/pure/layouts/partials/head.html

1
content/about.md

@ -2,6 +2,7 @@
title: "About"
date: 2019-02-08T23:42:14-06:00
type: "navLink"
weight: 1
---
[**sothr.com**](https://sothr.com) is in it's 3rd iteration, rewritten using the static site generator [Hugo](https://gohugo.io/) from the previous Refinery CMS branch. I don't update the site often enough to require a CMS style site, and I am no longer comfortable with the additional attack surface of such an application for a simple personal landing page. I've developed a custom Hugo theme based on [Pure.css](https://purecss.io/) which I find to be a refreshingly small css only layout library.

0
content/_index.md → content/index.md

6
content/portfolio/_index.md

@ -0,0 +1,6 @@
---
title: "Portfolio"
type: "navLink"
weight: 10
---
The following are projects of mine that I've collected and written about.

5
content/portfolio/sothr-dot-com-website.md

@ -0,0 +1,5 @@
---
title: "Sothr.com Website"
date: 2019-02-09T02:47:12-06:00
category: "Personal Project"
---

42
themes/pure/layouts/_default/list.html

@ -0,0 +1,42 @@
{{ define "main" }}
<h1>{{.Title}}</h1>
<div>
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{.Content}}
</div>
{{ $has_categories := gt (len (first 1 (where .Pages ".Params.category" "ne" nil))) 0 }}
{{ $has_without_categories := gt (len (first 1 (where .Pages ".Params.category" "eq" nil))) 0 }}
<!-- Ranges through content/posts/*.md -->
{{ if $has_categories }}
{{ range .Pages.GroupByParam "Category" }}
<div class="pure-g">
<div class="pure-u-1">
{{ if .Key }}
<h2>{{ .Key }}</h2>
{{ end }}
{{ range .Pages }}
<div class="pure-g">
<div class="pure-u-1">
<a href="{{.Permalink}}">{{.Title}}</a>
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
{{ if and $has_categories $has_without_categories }}
<div class="pure-g">
<div class="pure-u-1">
<h2>Others:</h2>
</div>
</div>
{{ end }}
{{ range where .Pages ".Params.category" "==" nil }}
<div class="pure-g">
<div class="pure-u-1">
<a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
</div>
</div>
{{ end }}
{{ end }}

2
themes/pure/layouts/partials/head.html

@ -17,7 +17,7 @@
<li class="pure-menu-list">
<a href="{{ .Site.BaseURL }}" class="pure-menu-heading pure-menu-link" title="Home">{{ .Site.Title }}</a>
</li>
{{ range where .Site.Pages "Type" "navLink" }}
{{ range where (sort .Site.Pages "Weight" "desc") "Type" "navLink"}}
<li class="pure-menu-list"><a href="{{ .URL }}" class="pure-menu-link" title="{{ .Title }}">{{ .Title }}</a></li>
{{ end }}
</ul>