diff options
author | Fastbyte01 <rogepix@gmail.com> | 2019-11-09 11:48:08 +0300 |
---|---|---|
committer | Fastbyte01 <rogepix@gmail.com> | 2019-11-09 11:48:08 +0300 |
commit | dd68036161f771a2a7091ed21486aca0ace7114a (patch) | |
tree | d02a44e425c6ba0865c352cfa178366dfb739818 | |
parent | 14ac587705c32970927630c5f2952dfd96dec8db (diff) |
Fix issue #39
Fix post doesn't show on homepage when post parameter is given
-rw-r--r-- | layouts/partials/home_post.html | 115 |
1 files changed, 59 insertions, 56 deletions
diff --git a/layouts/partials/home_post.html b/layouts/partials/home_post.html index 9103a78..45d84b2 100644 --- a/layouts/partials/home_post.html +++ b/layouts/partials/home_post.html @@ -1,71 +1,74 @@ +{{ $cdn_url := .Scratch.Get "cdn_url" }} <div class="post-warp"> - <div class="intro"> - {{ $cdn_url := .Scratch.Get "cdn_url" }} - {{ with .Site.Params.avatar}} - {{ $avatar := .}} - <div class="avatar"> - <a href="/posts/"> <img src="{{ (printf "%s%s" $cdn_url $avatar)}}"> </a> - </div> - {{ end }} - {{ if or .Params.gravatar.Email (and .Site.Params.gravatar.Email (ne .Params.gravatar.Email false)) }} - <div class="avatar"> - <a href="/posts/"> <img src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.gravatar.email }}?s=240&d=mp" alt="gravatar"> </a> - </div> - {{ end }} + <div class="intro"> + {{ with .Site.Params.avatar}} + {{ $avatar := .}} + <div class="avatar"> + <a href="/posts/"> <img src="{{ (printf "%s%s" $cdn_url $avatar)}}"> </a> + </div> + {{ end }} + {{ if or .Params.gravatar.Email (and .Site.Params.gravatar.Email (ne .Params.gravatar.Email false)) }} + <div class="avatar"> + <a href="/posts/"> <img + src="https://www.gravatar.com/avatar/{{ md5 .Site.Params.gravatar.email }}?s=240&d=mp" + alt="gravatar"> </a> + </div> + {{ end }} - {{ with .Site.Params.subtitle}} - <h2 class="description"> - {{ . }} - </h2> - {{ end }} - -</div> - {{ range (.Paginate .Pages).Pages }} - <article class="post" itemscope itemscope="" itemtype="http://schema.org/Article"> + {{ with .Site.Params.subtitle}} + <h2 class="description"> + {{ . }} + </h2> + {{ end }} - <header class="post-header"> - <h1 class="post-title" itemprop="name headline"><a href="{{ .Permalink }}">{{ .Title }}</a></h1> - </header> - <div class="post-content"> - <!--featured_image--> - {{ with .Params.featured_image }} - {{- $img := . -}} - <p><img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image"></p> - {{ end }} - <!-- end featured_image--> + </div> + {{ range (.Paginate .Pages).Pages }} + <article class="post" itemscope itemscope="" itemtype="http://schema.org/Article"> + + <header class="post-header"> + <h1 class="post-title" itemprop="name headline"><a href="{{ .Permalink }}">{{ .Title }}</a></h1> + </header> + <div class="post-content"> + <!--featured_image--> + {{ with .Params.featured_image }} + {{- $img := . -}} + <p><img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image"></p> + {{ end }} + <!-- end featured_image--> - {{ .Summary }} - </div> - <div class="post-footer"> - <div class="post-meta"> + {{ .Summary }} + </div> + <div class="post-footer"> + <div class="post-meta"> <span class="post-time"> - <time datetime={{.Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} itemprop="datePublished">{{ .Date.Format (.Site.Params.dateFormatToUse | default "2 January 2006") }}</time> + <time datetime={{.Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} + itemprop="datePublished">{{ .Date.Format (.Site.Params.dateFormatToUse | default "2 January 2006") }}</time> </span> in {{ with .Params.categories -}} <i class="iconfont icon-folder"></i> <span class="post-category"> - {{ range . }} - {{- $name := . -}} - {{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} - <a href="{{ .Permalink }}"> {{ $name }} </a> - {{ end -}} - {{ end }} + {{ range . }} + {{- $name := . -}} + {{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}} + <a href="{{ .Permalink }}"> {{ $name }} </a> + {{ end -}} + {{ end }} </span> {{- end }} + </div> + {{ with .Params.tags }} + <div class="post-tags"> + {{ range . }} + <span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"> + #{{.}}</a></span> + {{ end }} + </div> + {{ end }} </div> - {{ with .Params.tags }} - <div class="post-tags"> - {{ range . }} - <span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"> - #{{.}}</a></span> - {{ end }} - </div> - {{ end }} - </div> - </article> - {{ end }} + </article> + {{ end }} - {{ partial "paginator.html" . }} -</div> + {{ partial "paginator.html" . }} +</div>
\ No newline at end of file |