diff options
author | goransv <gsv@appernetic.io> | 2018-08-31 17:03:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-31 17:03:19 +0300 |
commit | 0e4d76c3ac15149cb3d25ae3c57545f0bcaf2f2b (patch) | |
tree | 2ed34a3a6aecdeed77961d3698915a1a4e0c3fda | |
parent | e21fa2492ed7fc58ab954d311f83339ea5fb50cb (diff) | |
parent | b4fcf0eaffa662cdd3e3feea86966cd1c6b50c79 (diff) |
Merge pull request #29 from lukas-sites/multiple-writers
Added Multiple Writers Feature
-rw-r--r-- | exampleSite/config.toml | 26 | ||||
-rw-r--r-- | exampleSite/content/post/work1.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work10.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work11.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work2.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work3.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work4.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work5.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work7.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work8.md | 1 | ||||
-rw-r--r-- | exampleSite/content/post/work9.md | 1 | ||||
-rw-r--r-- | layouts/_default/single.html | 44 | ||||
-rw-r--r-- | layouts/partials/portfolio.html | 15 |
13 files changed, 67 insertions, 28 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index b1d47f9..3938aa2 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -67,3 +67,29 @@ paginate = 5 #frontpage pagination github = "full profile url in github" pinterest = "full profile url in pinterest" rss = true + + [params.writers] + [params.writers."Lukas Herman"] + link = "https://lherman.tk" + email = "writer_email@example.com" + facebook = "full profile url in facebook" + googleplus = "full profile url in googleplus" + twitter = "full profile url in twitter" + linkedin = "full profile url in linkedin" + stackoverflow = "full profile url in stackoverflow" + instagram = "full profile url in instagram" + github = "full profile url in github" + pinterest = "full profile url in pinterest" + + [params.writers."Göran Svensson"] + link = "https://appernetic.io/" + email = "writer_email@example.com" + facebook = "full profile url in facebook" + googleplus = "full profile url in googleplus" + twitter = "full profile url in twitter" + linkedin = "full profile url in linkedin" + stackoverflow = "full profile url in stackoverflow" + instagram = "full profile url in instagram" + github = "full profile url in github" + pinterest = "full profile url in pinterest" + diff --git a/exampleSite/content/post/work1.md b/exampleSite/content/post/work1.md index 7b1d704..6f4a5cf 100644 --- a/exampleSite/content/post/work1.md +++ b/exampleSite/content/post/work1.md @@ -4,6 +4,7 @@ draft = false image = "img/portfolio/a4-paper.jpg" date = "2016-11-05T18:25:22+05:30" title = "Name of the work 1" +writer = "Göran Svensson" weight = 0 +++ diff --git a/exampleSite/content/post/work10.md b/exampleSite/content/post/work10.md index 20e9ab7..2687c8e 100644 --- a/exampleSite/content/post/work10.md +++ b/exampleSite/content/post/work10.md @@ -4,6 +4,7 @@ image = "img/portfolio/trifold.jpg" showonlyimage = true date = "2016-11-05T20:22:08+05:30" title = "Item with image" +writer = "Göran Svensson" weight = 10 +++ diff --git a/exampleSite/content/post/work11.md b/exampleSite/content/post/work11.md index 17c6117..02bfb41 100644 --- a/exampleSite/content/post/work11.md +++ b/exampleSite/content/post/work11.md @@ -4,6 +4,7 @@ image = "img/portfolio/paper-presentation.jpg" showonlyimage = true date = "2016-11-05T20:23:59+05:30" title = "Item with image" +writer = "Göran Svensson" weight = 11 +++ diff --git a/exampleSite/content/post/work2.md b/exampleSite/content/post/work2.md index 3826e6a..9215ab8 100644 --- a/exampleSite/content/post/work2.md +++ b/exampleSite/content/post/work2.md @@ -1,6 +1,7 @@ +++ date = "2016-11-05T19:41:01+05:30" title = "This is a Standard Post" +writer = "Göran Svensson" draft = false image = "img/portfolio/logs1.jpg" showonlyimage = false diff --git a/exampleSite/content/post/work3.md b/exampleSite/content/post/work3.md index e5cba6d..37d2ac8 100644 --- a/exampleSite/content/post/work3.md +++ b/exampleSite/content/post/work3.md @@ -3,6 +3,7 @@ image = "img/portfolio/bridge1.jpg" showonlyimage = false date = "2016-11-05T19:44:32+05:30" title = "Another Awesome Post" +writer = "Göran Svensson" categories = [ "travel" ] draft = false weight = 2 diff --git a/exampleSite/content/post/work4.md b/exampleSite/content/post/work4.md index c467c84..0982df5 100644 --- a/exampleSite/content/post/work4.md +++ b/exampleSite/content/post/work4.md @@ -4,6 +4,7 @@ image = "" showonlyimage = false date = "2016-11-05T19:50:47+05:30" title = "A post without an Image" +writer = "Göran Svensson" categories = [ "code" ] weight = 4 +++ diff --git a/exampleSite/content/post/work5.md b/exampleSite/content/post/work5.md index 5909723..48a6833 100644 --- a/exampleSite/content/post/work5.md +++ b/exampleSite/content/post/work5.md @@ -4,6 +4,7 @@ showonlyimage = true draft = false date = "2016-11-05T19:53:42+05:30" title = "A Totally Response Theme" +writer = "Göran Svensson" categories = [ "photography" ] weight = 5 +++ diff --git a/exampleSite/content/post/work7.md b/exampleSite/content/post/work7.md index eba3afd..e76bcab 100644 --- a/exampleSite/content/post/work7.md +++ b/exampleSite/content/post/work7.md @@ -3,6 +3,7 @@ image = "img/portfolio/bike1.jpg" showonlyimage = false date = "2016-11-05T19:57:40+05:30" title = "Post with a Gallery" +writer = "Göran Svensson" draft = false weight = 7 +++ diff --git a/exampleSite/content/post/work8.md b/exampleSite/content/post/work8.md index c68e697..d364df0 100644 --- a/exampleSite/content/post/work8.md +++ b/exampleSite/content/post/work8.md @@ -4,6 +4,7 @@ draft = false image = "img/portfolio/camera1.jpg" date = "2016-11-05T19:59:22+05:30" title = "A Post with lot of comments" +writer = "Göran Svensson" weight = 8 +++ diff --git a/exampleSite/content/post/work9.md b/exampleSite/content/post/work9.md index 83830a5..646101a 100644 --- a/exampleSite/content/post/work9.md +++ b/exampleSite/content/post/work9.md @@ -4,6 +4,7 @@ image = "img/portfolio/birds.jpg" showonlyimage = false date = "2016-11-05T20:02:19+05:30" title = "Blogging is Fun and Worthwhile" +writer = "Göran Svensson" weight = 9 +++ diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 80172d8..414a808 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,10 +1,17 @@ {{ define "body" }} <body class="post-template-default single single-post single-format-standard ct-body singular singular-post not-front standard"> - {{ end }} +{{ end }} - {{ define "main" }} +{{ define "main" }} + {{ $scratch := newScratch }} + {{ if .Site.Params.writers }} + {{ $scratch.Set "writer" (index .Site.Params.writers (lower .Params.writer) | default dict) }} + {{ else }} + {{ $scratch.Set "writer" .Site.Params.social | default dict }} + {{ end }} + {{ $writer := $scratch.Get "writer" }} <div id="loop-container" class="loop-container"> {{ if and (isset .Params "image") .Params.image }} <div class="post type-post status-publish format-standard has-post-thumbnail hentry category-design tag-design tag-standard-2 tag-tagalicious tag-travel entry full-without-featured odd excerpt-1"> @@ -20,11 +27,7 @@ <span class="date">{{ .Date.Format "02 January" }}</span> <span> / </span> <span class="author"> - {{ if and (isset .Site.Params "authorlink") .Site.Params.authorLink }} - <a href="{{ .Site.Params.authorLink | default "" | absURL}}" title="Posts by {{ .Site.Params.author | default "" }}" rel="author">{{ .Site.Params.author | default ""}}</a> - {{ else }} - {{ .Site.Params.author | default "" }} - {{ end }} + <a href="{{ $writer.link | default "" | absURL}}" title="Posts by {{ .Params.writer | default "" }}" rel="author">{{ .Params.writer | default ""}}</a> </span> @@ -77,22 +80,21 @@ {{ end }} </p></div> </div> -{{ if and (isset .Site.Params "author") .Site.Params.author }} <div class="author-meta"> <div class="author"> - <img alt='{{ .Site.Params.author | default "" }}' src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.email | default "" }}?s=100&d=identicon" class='avatar avatar-72 photo' height='72' width='72'> + <img alt='{{ .Params.writer }}' src="https://www.gravatar.com/avatar/{{ md5 $writer.email | default "" }}?s=100&d=identicon" class='avatar avatar-72 photo' height='72' width='72'> <span> - Written by:<a href="{{ .Site.Params.authorLink | default "" | absURL}}" title="Posts by {{ .Site.Params.author | default "" }}" rel="author">{{ .Site.Params.author | default "" }}</a> </span> + Written by:<a href="{{ $writer.link | default "" | absURL}}" title="Posts by {{ .Params.writer }}" rel="author">{{ .Params.writer }}</a> </span> </div> <div class="bio"> - {{ range .Site.Params.bio }} + {{ range $writer.bio }} <p>{{ . | default "" | safeHTML }}</p> {{ end }} - {{ with .Site.Params.social.facebook }} + {{ with $writer.facebook }} <a class="facebook" target="_blank" href="{{ . }}"> <i class="fa fa-facebook" @@ -100,7 +102,7 @@ </a> {{end}} - {{ with .Site.Params.social.googleplus }} + {{ with $writer.googleplus }} <a class="googleplus" target="_blank" href="{{ . }}"> <i class="fa fa-google-plus" @@ -109,14 +111,14 @@ {{end}} - {{ with .Site.Params.social.twitter }} + {{ with $writer.twitter }} <a class="twitter" target="_blank" href="{{ . }}"> <i class="fa fa-twitter-square" title="twitter icon"></i> </a> {{end}} -{{ with .Site.Params.social.linkedin }} +{{ with $writer.linkedin }} <a class="linkedin" target="_blank" href="{{ . }}"> <i class="fa fa-linkedin-square" @@ -124,7 +126,7 @@ title="linkedin icon"></i> </a> {{end}} -{{ with .Site.Params.social.email }} +{{ with $writer.email }} <a class="email" target="_blank" href="mailto:{{ . }}"> <i class="fa fa-envelope" @@ -132,7 +134,7 @@ title="email icon"></i> </a> {{end}} -{{ with .Site.Params.social.instagram }} +{{ with $writer.instagram }} <a class="instagram" target="_blank" href="{{ . }}"> <i class="fa fa-instagram" @@ -140,7 +142,7 @@ title="instagram icon"></i> </a> {{end}} -{{ with .Site.Params.social.stackoverflow }} +{{ with $writer.stackoverflow }} <a class="stackoverflow" target="_blank" href="{{ . }}"> <i class="fa fa-stack-overflow" @@ -148,7 +150,7 @@ title="stackoverflow icon"></i> </a> {{end}} -{{ with .Site.Params.social.github }} +{{ with $writer.github }} <a class="github" target="_blank" href="{{ . }}"> <i class="fa fa-github" @@ -157,7 +159,7 @@ title="github icon"></i> {{end}} -{{ with .Site.Params.social.pinterest }} +{{ with $writer.pinterest }} <a class="pinterest" target="_blank" href="{{ . }}"> <i class="fa fa-pinterest" @@ -169,7 +171,7 @@ title="pinterest icon"></i> </div> </div> -{{ end }} + </div> </div> diff --git a/layouts/partials/portfolio.html b/layouts/partials/portfolio.html index 5dddbb3..4db2f15 100644 --- a/layouts/partials/portfolio.html +++ b/layouts/partials/portfolio.html @@ -3,6 +3,13 @@ <div id="loop-container" class="loop-container"> {{ $paginator := .Paginate (where (where .Site.Pages "Type" "post") "IsPage" true) }} {{ range $index, $element := .Paginator.Pages }} + {{ $scratch := newScratch }} + {{ if .Site.Params.writers }} + {{ $scratch.Set "writer" (index .Site.Params.writers (lower .Params.writer) | default dict) }} + {{ else }} + {{ $scratch.Set "writer" .Site.Params.social | default dict }} + {{ end }} + {{ $writer := $scratch.Get "writer" }} {{ if and (isset .Params "image") .Params.image }} {{ if eq (mod $index 2) 0 }} <div class="post type-post status-publish format-standard has-post-thumbnail hentry category-design tag-memories tag-normal-post tag-standard-2 excerpt zoom full-without-featured odd excerpt"> @@ -23,16 +30,10 @@ <div class="excerpt-meta"> <span class="date">{{ .Date.Format "02 January" }}</span> <span> / </span> - {{ if and (isset .Site.Params "author") .Site.Params.author }} <span class="author"> - {{ if and (isset .Site.Params "authorlink") .Site.Params.authorLink }} - <a href="{{ .Site.Params.authorLink | default "" | absURL }}" title="Posts by {{ .Site.Params.author | default "" }}" rel="author">{{ .Site.Params.author | default "" }}</a> - {{ else }} - {{ .Site.Params.author | default "" }} - {{ end }} + <a href="{{ $writer.link | default "" | absURL }}" title="Posts by {{ .Params.writer }}" rel="author">{{ .Params.writer }}</a> </span> - {{ end }} {{ range .Params.categories }} <span> / </span> |