Welcome to mirror list, hosted at ThFree Co, Russian Federation.

single.html « _default « layouts - github.com/liuzc/LeaveIt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1f952c8266824908d724d113312a4b59ceee4c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{{ define "content" -}}
{{ $cdn_url := .Scratch.Get "cdn_url" }}
<article class="post-warp" itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
        <h1 class="post-title" itemprop="name headline">{{ .Title }}</h1>
        <div class="post-meta">
                Written by <a itemprop="name" href="{{.Site.BaseURL }}" rel="author">{{ if isset .Params "author" }}{{ .Params.author }}{{ else }}{{ .Site.Params.author }}{{ end }}</a> with ♥ 
                <span class="post-time">
                on <time datetime={{.Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} itemprop="datePublished">{{ .Date.Format (.Site.Params.dateFormatToUse | default "January 2, 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 }}
                </span>
                {{- end }}
        </div>
    </header>
    <div class="post-content">
        <!--featured_image-->

        {{ $images := findRE "<img src=\"[^\"|\\\"]*\"" .Content -}}
        {{ if ge (len $images) 1}}
            {{ $.Scratch.Set "postHasImages" true }}
        {{ end }}

        {{ with .Params.featured_image }}
          {{- $img := . -}}
          <img src="{{ printf "%s%s" $cdn_url $img }}" class="featured_image">
        {{ end }}
        <!-- end featured_image-->
     
          {{ $reAltIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" />" }}
          {{ $reAltOut :=  ( printf "<figure><img src=\"/images/ring.svg\" data-sizes=\"auto\" data-src=\"%s$1\" alt=\"$2\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }}
          {{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }}

          {{ $reAltTitleIn := "<img src=\"([^\"]+)\" alt=\"([^\"]+)?\" title=\"([^\"]+)?\" />" }}
          {{ $reAltTitleOut := ( printf "<figure><img src=\"/images/ring.svg\" data-src=\"%s$1\" data-sizes=\"auto\" alt=\"$2\" title=\"$3\" class=\"lazyload\"><figcaption class=\"image-caption\">$2</figcaption></figure>" $cdn_url ) }}
          {{ $finalContent := $altContent | replaceRE $reAltTitleIn $reAltTitleOut | safeHTML }}

          {{ $finalContent }}
    </div>

    <div class="post-copyright">
            {{ with .Site.Params.author }} 
            <p class="copyright-item">
                <span>Author:</span>
                <span>{{ . }} </span>
                </p>
            {{ end }}
           
            {{ with .Permalink }} 
            <p class="copyright-item">
                    <span>Link:</span>
                    <a href={{ . }}>{{ . }}</span>
            </p>
            {{ end }}
            {{ with .Site.Params.license }} 
            <p class="copyright-item lincese">
                {{ . | safeHTML}}
            </p>
            {{ end }}
    </div>

     {{ with .Params.tags }}
    <div class="post-tags">
        <section style="float:left;">
        <i class="iconfont icon-tag"></i>Tag(s): 
        {{ range . }}
        <span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/">
                #{{.}}</a></span>
        {{ end }}
        </section>
        <section style="float:right;">
                <a href="javascript:window.history.back();">back</a></span> · 
                <span><a href="{{ "/" | absURL}}">home</a></span>
        </section>
    </div>
    {{ end }}
    <div class="post-nav">
        {{ if .PrevInSection }}
        <a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i class="iconfont icon-left"></i>&nbsp;{{ .PrevInSection.Title}}</a>
        {{ end }} 
        {{ if .NextInSection }}
        <a href="{{.NextInSection.Permalink}}" class="next" rel="next" title="{{.NextInSection.Title}}">{{.NextInSection.Title}}&nbsp;<i class="iconfont icon-right"></i></a>
        {{ end }}
    </div>
</article>
{{- end }}