diff --git a/layouts/index.html b/layouts/index.html index 0fd1e65..41b3f90 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -21,7 +21,7 @@

Blog

- {{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }} + {{ partial "summary_string.html" . }}

{{ end }} @@ -32,7 +32,7 @@

Projects

- {{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }} + {{ partial "summary_string.html" . }}

{{ end }} @@ -45,7 +45,7 @@

Setup

- {{ .Params.summary | default .Summary | truncate .Site.Params.summary_length_long "..." }} + {{ partial "summary_string.html" . }}

{{ end }} diff --git a/layouts/partials/box.html b/layouts/partials/box.html index 11d8b55..cd408fb 100644 --- a/layouts/partials/box.html +++ b/layouts/partials/box.html @@ -3,6 +3,6 @@

{{ title .LinkTitle }}

-

{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length "..." }}

+ {{ partial "summary_string.html" . }} diff --git a/layouts/partials/box_image.html b/layouts/partials/box_image.html index 1d18f22..cb9fd45 100644 --- a/layouts/partials/box_image.html +++ b/layouts/partials/box_image.html @@ -8,6 +8,6 @@

{{ title .LinkTitle }}

-

{{ .Params.summary | default .Summary | truncate .Site.Params.summary_length "..." }}

+ {{ partial "summary_string.html" . }} diff --git a/layouts/partials/content.html b/layouts/partials/content.html index cc31bf2..efca1b0 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -1,14 +1,6 @@

{{ title .Title }}

- {{ if .Params.subtitle }} -

{{ markdownify .Params.subtitle }}

- {{ else if .Params.repo }} - {{ $data := getJSON "https://api.github.com/repos/" .Params.repo }} -

{{ $data.description }}

- {{ else if .Params.gist }} - {{ $data := getJSON "https://api.github.com/gists/" .Params.gist }} -

{{ $data.description }}

- {{ end }} +

{{ partial "subtitle_string.html" . }}

{{ if .Content }}
diff --git a/layouts/partials/subtitle_string.html b/layouts/partials/subtitle_string.html new file mode 100644 index 0000000..4275d61 --- /dev/null +++ b/layouts/partials/subtitle_string.html @@ -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 }} diff --git a/layouts/partials/summary_string.html b/layouts/partials/summary_string.html new file mode 100644 index 0000000..7f0f091 --- /dev/null +++ b/layouts/partials/summary_string.html @@ -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 }}