More complicated way of getting summary and subtitle
This commit is contained in:
parent
82b6a896ad
commit
6df0a4eff8
6 changed files with 27 additions and 14 deletions
|
@ -21,7 +21,7 @@
|
||||||
<h3>Blog</h3>
|
<h3>Blog</h3>
|
||||||
</a>
|
</a>
|
||||||
<p>
|
<p>
|
||||||
{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }}
|
{{ partial "summary_string.html" . }}
|
||||||
</p>
|
</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
<h3>Projects</h3>
|
<h3>Projects</h3>
|
||||||
</a>
|
</a>
|
||||||
<p>
|
<p>
|
||||||
{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }}
|
{{ partial "summary_string.html" . }}
|
||||||
</p>
|
</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<h3>Setup</h3>
|
<h3>Setup</h3>
|
||||||
</a>
|
</a>
|
||||||
<p>
|
<p>
|
||||||
{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }}
|
{{ partial "summary_string.html" . }}
|
||||||
</p>
|
</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
<a href="{{ .Permalink }}">
|
<a href="{{ .Permalink }}">
|
||||||
<h3>{{ title .LinkTitle }}</h3>
|
<h3>{{ title .LinkTitle }}</h3>
|
||||||
</a>
|
</a>
|
||||||
<p>{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length "..." }}</p>
|
{{ partial "summary_string.html" . }}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
<a href="{{ .Permalink }}">
|
<a href="{{ .Permalink }}">
|
||||||
<h3>{{ title .LinkTitle }}</h3>
|
<h3>{{ title .LinkTitle }}</h3>
|
||||||
</a>
|
</a>
|
||||||
<p>{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length "..." }}</p>
|
{{ partial "summary_string.html" . }}
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
<header>
|
<header>
|
||||||
<h2>{{ title .Title }}</h2>
|
<h2>{{ title .Title }}</h2>
|
||||||
{{ if .Params.subtitle }}
|
<p>{{ partial "subtitle_string.html" . }}</p>
|
||||||
<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 }}
|
|
||||||
</header>
|
</header>
|
||||||
{{ if .Content }}
|
{{ if .Content }}
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|
7
layouts/partials/subtitle_string.html
Normal file
7
layouts/partials/subtitle_string.html
Normal 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 }}
|
14
layouts/partials/summary_string.html
Normal file
14
layouts/partials/summary_string.html
Normal 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 }}
|
Loading…
Reference in a new issue