1
Fork 0

More complicated way of getting summary and subtitle

This commit is contained in:
Jake Howard 2017-07-14 22:10:18 +01:00
parent 82b6a896ad
commit 6df0a4eff8
Signed by: jake
GPG key ID: 57AFB45680EDD477
6 changed files with 27 additions and 14 deletions

View file

@ -21,7 +21,7 @@
<h3>Blog</h3>
</a>
<p>
{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }}
{{ partial "summary_string.html" . }}
</p>
{{ end }}
</section>
@ -32,7 +32,7 @@
<h3>Projects</h3>
</a>
<p>
{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }}
{{ partial "summary_string.html" . }}
</p>
{{ end }}
</section>
@ -45,7 +45,7 @@
<h3>Setup</h3>
</a>
<p>
{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }}
{{ partial "summary_string.html" . }}
</p>
{{ end }}
</section>

View file

@ -3,6 +3,6 @@
<a href="{{ .Permalink }}">
<h3>{{ title .LinkTitle }}</h3>
</a>
<p>{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length "..." }}</p>
{{ partial "summary_string.html" . }}
</section>
</div>

View file

@ -8,6 +8,6 @@
<a href="{{ .Permalink }}">
<h3>{{ title .LinkTitle }}</h3>
</a>
<p>{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length "..." }}</p>
{{ partial "summary_string.html" . }}
</section>
</div>

View file

@ -1,14 +1,6 @@
<header>
<h2>{{ title .Title }}</h2>
{{ if .Params.subtitle }}
<p>{{ markdownify .Params.subtitle }}</p>
{{ else if .Params.repo }}
{{ $data := getJSON "https://api.github.com/repos/" .Params.repo }}
<p>{{ $data.description }}</p>
{{ else if .Params.gist }}
{{ $data := getJSON "https://api.github.com/gists/" .Params.gist }}
<p>{{ $data.description }}</p>
{{ end }}
<p>{{ partial "subtitle_string.html" . }}</p>
</header>
{{ if .Content }}
<div class="box">

View file

@ -0,0 +1,7 @@
{{ if .Params.subtitle }}
{{ .Params.subtitle | markdownify }}
{{ else if .Params.repo }}
{{ (getJSON "https://api.github.com/repos/" .Params.repo).description }}
{{ else if .Params.gist }}
{{ (getJSON "https://api.github.com/gists/" .Params.gist).description }}
{{ end }}

View file

@ -0,0 +1,14 @@
{{ if eq .Section "posts" }}
{{ .Summary | truncate .Site.Params.summary_length "..." }}
{{ else }}
{{ if .Params.subtitle }}
{{ .Params.subtitle | markdownify }}
{{ else if .Params.repo }}
{{ (getJSON "https://api.github.com/repos/" .Params.repo).description }}
{{ else if .Params.gist }}
{{ (getJSON "https://api.github.com/gists/" .Params.gist).description }}
{{ else }}
{{ .Summary | truncate .Site.Params.summary_length "..." }}
{{ end }}
{{ end }}