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

title.html « pages « partials « layouts - github.com/2-REC/hugo-myportfolio-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 699bb86b363e08a1b940c79f4f82c16ba749809a (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
<hgroup>
    {{/* Title */}}
    <h1>{{ .Title }}</h1>

    {{/* Subtitle */}}
    {{ with .Params.subtitle }}
        <h2>{{ . }}</h2>
    {{ end }}

    {{/* Period */}}
    {{ if .Params.startDate }}
        <h3>
        From <i>{{ dateFormat .Site.Params.projects.date_format .Params.startDate }}</i>
        {{ if .Params.endDate }}
            {{ $end := (time .Params.endDate) }}
            {{ $duration := $end.Sub (time .Params.startDate) }}
            {{ $months := int (div (int (div $duration.Hours 24)) 30.4167) }}
            {{ $years := int (div $months 12) }}
            {{ $months := int (sub $months (mul $years 12)) }}

            to <i>{{ dateFormat .Site.Params.projects.date_format .Params.endDate }}</i>
            ({{ if gt $years 0 }}{{ $years }} year{{ if gt $years 1 }}s{{ end }}{{ end }}{{ if and (gt $years 0) (gt $months 0) }}, {{ end }}{{ if gt $months 0 }}{{ $months }} month{{ if gt $months 1 }}s{{ end }}{{ end }})
        {{ end }}
    </h3>
    {{ end }}
</hgroup>