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

home.html « sections « partials « layouts - github.com/hossainemruz/toha.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4976c0969be07bd4cec24f2b74df8f4d0a0140c4 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{{ $author:= site.Data.author }}
{{ if (index site.Data site.Language.Lang).author }}
  {{ $author = (index site.Data site.Language.Lang).author }}
{{ end }}

{{ $name:="Jane Doe" }}
{{ if $author.nickname }}
  {{ $name = $author.nickname }}
{{ else if $author.name }}
  {{ $name = $author.name }}
{{ end }}

{{ $sections:= site.Data.sections }}
{{ if (index site.Data site.Language.Lang).sections }}
  {{ $sections = (index site.Data site.Language.Lang).sections }}
{{ end }}

{{ $backgroundImage:= "/images/default-background.jpg" }}
{{ if site.Params.background }}
  {{ $backgroundImage = site.Params.background }}
{{ end }}


{{ $authorImage:= "/images/default-avatar.png" }}
{{ if $author.image }}
  {{ $authorImage = $author.image }}
{{ end }}
{{ $authorImage := resources.Get $authorImage }}
{{ $authorImage := $authorImage.Fit "148x148" }}

{{/* get file that matches the filename as specified as src="" in shortcode */}}
{{ $src := resources.Get $backgroundImage }}

{{/* set image sizes, these are hardcoded for now, x dictates that images are resized to this width */}}

{{ $tinyw := default "500x" }}
{{ $smallw := default "800x" }}
{{ $mediumw := default "1200x" }}
{{ $largew := default "1500x" }}

{{/* resize the src image to the given sizes */}}

{{ $tiny := $src.Resize $tinyw }}
{{ $small := $src.Resize $smallw }}
{{ $medium := $src.Resize $mediumw }}
{{ $large := $src.Resize $largew }}

{{/* only use images smaller than or equal to the src (original) image size, as Hugo will upscale small images */}}
{{/* set the sizes attribute to (min-width: 35em) 1200px, 100vw unless overridden in shortcode */}}

{{ if lt $src.Width "500" }}
  {{ $tiny := $src}}
  {{ $small := $src}}
  {{ $medium := $src}}
  {{ $large := $src}}
{{ end }}

{{ if lt $src.Width "800" }}
  {{ $small := $src}}
  {{ $medium := $src}}
  {{ $large := $src}}
{{ end }}

{{ if lt $src.Width "1200" }}
  {{ $medium := $src}}
  {{ $large := $src}}
{{ end }}

{{ if lt $src.Width "1500" }}
  {{ $large := $src}}
{{ end }}

<div class="container-fluid home" id="home">
  <style>
    /* 0 to 299 */
    #homePageBackgroundImageDivStyled {
      /*background-image: url('{{ $tiny.RelPermalink }}'); This does not work on https://themes.gohugo.io/ */
      background-image: url('{{ strings.TrimSuffix "/" site.BaseURL }}{{ $tiny.RelPermalink }}');
    }
    /* 300 to X */
    @media (min-width: 500px) and (max-width: 800px) { /* or 301 if you want really the same as previously.  */
      #homePageBackgroundImageDivStyled {   
          background-image: url('{{ strings.TrimSuffix "/" site.BaseURL }}{{ $small.RelPermalink }}');
        }
    }
    @media (min-width: 801px) and (max-width: 1200px) { /* or 301 if you want really the same as previously.  */
      #homePageBackgroundImageDivStyled {   
          background-image: url('{{ strings.TrimSuffix "/" site.BaseURL }}{{ $medium.RelPermalink }}');
        }
    }
    @media (min-width: 1201px) and (max-width: 1500px) { /* or 301 if you want really the same as previously.  */
      #homePageBackgroundImageDivStyled {   
          background-image: url('{{ strings.TrimSuffix "/" site.BaseURL }}{{ $large.RelPermalink }}');
        }
    }
    @media (min-width: 1501px) { /* or 301 if you want really the same as previously.  */
      #homePageBackgroundImageDivStyled {   
          background-image: url('{{ strings.TrimSuffix "/" site.BaseURL }}{{ $src.RelPermalink }}');
        }
    }
    </style>
    <span class="on-the-fly-behavior"></span>
  <div
    id="homePageBackgroundImageDivStyled"
    class="background container-fluid"
  ></div>
  <div class="container content text-center">
    <img src="{{ $authorImage.RelPermalink }}"
      class="rounded-circle mx-auto d-block img-fluid"
      alt="Author Image"
    />
    <h1 class="greeting"> {{ $author.greeting }} {{ $name }}</h1>
    <div class="typing-carousel">
      <span id="ityped" class="ityped"></span>
      <span class="ityped-cursor"></span>
    </div>
    <ul id="typing-carousel-data">
      {{ if $author.summary }}
        {{ range $author.summary }}
          <li>{{ . }}</li>
        {{ end}}
      {{ end }}
    </ul>
    {{ if $sections }}
      {{ range first 1 (where (sort $sections "section.weight") ".section.enable" true) }}
        {{ $sectionID := replace (lower .section.name) " " "-"  }}
        {{ if .section.id }}
          {{ $sectionID = .section.id }}
        {{ end }}
        <a href="#{{ $sectionID }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
      {{ end }}
    {{ end }}
  </div>
</div>