Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gonnux/hugo-apps-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByeonggon Lee <gonny952@gmail.com>2020-03-08 22:12:08 +0300
committerByeonggon Lee <gonny952@gmail.com>2020-03-08 22:12:08 +0300
commit46d8b5e7f73b63336f6370c3f74bf0968b7b9845 (patch)
tree4998b96958bf25ba9231d6de0bbb5e703b4d71c7
parente4242f149b2945833a996693978f3641bb359b52 (diff)
Support complex apps
-rw-r--r--archetypes/default.md1
-rw-r--r--exampleSite/config.toml3
-rw-r--r--layouts/_default/list.html40
3 files changed, 36 insertions, 8 deletions
diff --git a/archetypes/default.md b/archetypes/default.md
index 4340ff0..38cf122 100644
--- a/archetypes/default.md
+++ b/archetypes/default.md
@@ -5,4 +5,5 @@ date: {{ .Date }}
enableDisqus: true
full: false
img: ""
+tags: []
---
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index ed487eb..3d4db71 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -6,6 +6,9 @@ googleAnalytics = ""
title = "Your site title"
copyright = ""
+[taxonomies]
+ tag = "tags"
+
[params]
googleAutoAds = ""
avatar = "https://openclipart.org/download/103855/tux.svg"
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index a0777f3..1a2fc6c 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,19 +1,43 @@
{{ define "main" }}
<div class="apps-list">
+ <!-- data/TYPENAME/ITEMNAME/hugo.json-->
+ {{ $curTypeName := ($.Permalink | path.Dir | path.Split).File }}
+ <h1>{{- $curTypeName -}}</h1>
+ {{ range $typeName, $type := .Site.Data }}
+ {{ if eq $typeName $curTypeName }}
+ {{ range $itemName, $itemMap := $type }}
+ {{ $item := $itemMap.hugo }}
+ {{ $title := $item.title | default $itemName }}
+ {{ $itemUrl := $item.url | default (print "/" $typeName "/" $itemName | absURL) }}
+ {{ $imageUrl := $item.image | default (print "/img/no-image.svg" | absURL) }}
+ <div class="apps-app-item">
+ <div class="apps-app-icon">
+ <a href="{{- $itemUrl -}}">
+ <img src="{{- $imageUrl -}}"/>
+ </a>
+ </div>
+ <div class="apps-app-name">
+ <a href="{{- $itemUrl -}}">
+ <h6>{{- $title -}}</h6>
+ </a>
+ </div>
+ </div>
+ {{ end }}
+ {{ end }}
+ {{ end }}
{{ range .Pages }}
<div class="apps-app-item">
<div class="apps-app-icon">
- <a href="{{ .Permalink }}">
- {{ if or (not (isset .Params "img")) (eq .Params.img "") }}
- <img src="{{ .Site.BaseURL }}/img/no-image.svg"/>
- {{ else }}
- <img src="{{ .Params.img }}"/>
- {{ end }}
+ {{ $title := (.Permalink | path.Dir | path.Split).File }}
+ {{ $itemUrl := .Permalink }}
+ {{ $imageUrl := .Params.img | default (print "/img/no-image.svg" | absURL) }}
+ <a href="{{- $itemUrl -}}">
+ <img src="{{- $imageUrl -}}"/>
</a>
</div>
<div class="apps-app-name">
- <a href="{{ .Permalink }}">
- <h6>{{- .Title -}}</h6>
+ <a href="{{- $itemUrl -}}">
+ <h6>{{- $title -}}</h6>
</a>
</div>
</div>