home.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. {{ $author:= site.Data.author }}
  2. {{ if (index site.Data site.Language.Lang).author }}
  3. {{ $author = (index site.Data site.Language.Lang).author }}
  4. {{ end }}
  5. {{ $name:="Jane Doe" }}
  6. {{ if $author.nickname }}
  7. {{ $name = $author.nickname }}
  8. {{ else if $author.name }}
  9. {{ $name = $author.name }}
  10. {{ end }}
  11. {{ $sections:= site.Data.sections }}
  12. {{ if (index site.Data site.Language.Lang).sections }}
  13. {{ $sections = (index site.Data site.Language.Lang).sections }}
  14. {{ end }}
  15. {{ $backgroundImage:= "/images/default-background.jpg" }}
  16. {{ if site.Params.background }}
  17. {{ $backgroundImage = site.Params.background }}
  18. {{ end }}
  19. {{ $darkBackgroundImage:= $backgroundImage }}
  20. {{ if site.Params.darkBackground }}
  21. {{ $darkBackgroundImage = site.Params.darkBackground }}
  22. {{ end }}
  23. {{ $authorImage:= "/images/default-avatar.png" }}
  24. {{ if $author.image }}
  25. {{ $authorImage = $author.image }}
  26. {{ end }}
  27. {{ $authorImage := resources.Get $authorImage }}
  28. {{/* apply image processing. don't use "Fit" in svg or gif because its not supported */}}
  29. {{ if and $authorImage (and (ne $authorImage.MediaType.SubType "svg") ( ne $authorImage.MediaType.SubType "gif")) }}
  30. {{ $authorImage = $authorImage.Fit "148x148" }}
  31. {{ end }}
  32. {{/* get file that matches the filename as specified as src="" in shortcode */}}
  33. {{ $src := resources.Get $backgroundImage }}
  34. {{/* set image sizes, these are hardcoded for now, x dictates that images are resized to this width */}}
  35. {{ $tinyw := default "500x" }}
  36. {{ $smallw := default "800x" }}
  37. {{ $mediumw := default "1200x" }}
  38. {{ $largew := default "1500x" }}
  39. {{/* resize the src image to the given sizes */}}
  40. {{ $tiny := $src.Resize $tinyw }}
  41. {{ $small := $src.Resize $smallw }}
  42. {{ $medium := $src.Resize $mediumw }}
  43. {{ $large := $src.Resize $largew }}
  44. {{/* only use images smaller than or equal to the src (original) image size, as Hugo will upscale small images */}}
  45. {{/* set the sizes attribute to (min-width: 35em) 1200px, 100vw unless overridden in shortcode */}}
  46. {{ if lt $src.Width "500" }}
  47. {{ $tiny := $src}}
  48. {{ $small := $src}}
  49. {{ $medium := $src}}
  50. {{ $large := $src}}
  51. {{ end }}
  52. {{ if lt $src.Width "800" }}
  53. {{ $small := $src}}
  54. {{ $medium := $src}}
  55. {{ $large := $src}}
  56. {{ end }}
  57. {{ if lt $src.Width "1200" }}
  58. {{ $medium := $src}}
  59. {{ $large := $src}}
  60. {{ end }}
  61. {{ if lt $src.Width "1500" }}
  62. {{ $large := $src}}
  63. {{ end }}
  64. {{/* get file that matches the filename as specified as src="" in shortcode */}}
  65. {{ $darkSrc := resources.Get $darkBackgroundImage }}
  66. {{/* resize the src image to the given sizes */}}
  67. {{ $darkTiny := $darkSrc.Resize $tinyw }}
  68. {{ $darkSmall := $darkSrc.Resize $smallw }}
  69. {{ $darkMedium := $darkSrc.Resize $mediumw }}
  70. {{ $darkLarge := $darkSrc.Resize $largew }}
  71. {{/* only use images smaller than or equal to the src (original) image size, as Hugo will upscale small images */}}
  72. {{/* set the sizes attribute to (min-width: 35em) 1200px, 100vw unless overridden in shortcode */}}
  73. {{ if lt $darkSrc.Width "500" }}
  74. {{ $darkTiny := $src}}
  75. {{ $darkSmall := $src}}
  76. {{ $darkMedium := $src}}
  77. {{ $darkLarge := $src}}
  78. {{ end }}
  79. {{ if lt $src.Width "800" }}
  80. {{ $darkSmall := $src}}
  81. {{ $darkMedium := $src}}
  82. {{ $darkLarge := $src}}
  83. {{ end }}
  84. {{ if lt $src.Width "1200" }}
  85. {{ $darkMedium := $src}}
  86. {{ $darkLarge := $src}}
  87. {{ end }}
  88. {{ if lt $src.Width "1500" }}
  89. {{ $darkLarge := $src}}
  90. {{ end }}
  91. <div class="container-fluid home" id="home">
  92. <style>
  93. /* 0 to 299 */
  94. #homePageBackgroundImageDivStyled {
  95. background-image: url('{{ $tiny.RelPermalink }}');
  96. }
  97. /* 300 to X */
  98. @media (min-width: 500px) and (max-width: 800px) { /* or 301 if you want really the same as previously. */
  99. #homePageBackgroundImageDivStyled {
  100. background-image: url('{{ $small.RelPermalink }}');
  101. }
  102. }
  103. @media (min-width: 801px) and (max-width: 1200px) { /* or 301 if you want really the same as previously. */
  104. #homePageBackgroundImageDivStyled {
  105. background-image: url('{{ $medium.RelPermalink }}');
  106. }
  107. }
  108. @media (min-width: 1201px) and (max-width: 1500px) { /* or 301 if you want really the same as previously. */
  109. #homePageBackgroundImageDivStyled {
  110. background-image: url('{{ $large.RelPermalink }}');
  111. }
  112. }
  113. @media (min-width: 1501px) { /* or 301 if you want really the same as previously. */
  114. #homePageBackgroundImageDivStyled {
  115. background-image: url('{{ $src.RelPermalink }}');
  116. }
  117. }
  118. html[data-theme='dark'] {
  119. /* 0 to 299 */
  120. #homePageBackgroundImageDivStyled {
  121. background-image: url('{{ $darkTiny.RelPermalink }}');
  122. }
  123. /* 300 to X */
  124. @media (min-width: 500px) and (max-width: 800px) { /* or 301 if you want really the same as previously. */
  125. #homePageBackgroundImageDivStyled {
  126. background-image: url('{{ $darkSmall.RelPermalink }}');
  127. }
  128. }
  129. @media (min-width: 801px) and (max-width: 1200px) { /* or 301 if you want really the same as previously. */
  130. #homePageBackgroundImageDivStyled {
  131. background-image: url('{{ $darkMedium.RelPermalink }}');
  132. }
  133. }
  134. @media (min-width: 1201px) and (max-width: 1500px) { /* or 301 if you want really the same as previously. */
  135. #homePageBackgroundImageDivStyled {
  136. background-image: url('{{ $darkLarge.RelPermalink }}');
  137. }
  138. }
  139. @media (min-width: 1501px) { /* or 301 if you want really the same as previously. */
  140. #homePageBackgroundImageDivStyled {
  141. background-image: url('{{ $darkSrc.RelPermalink }}');
  142. }
  143. }
  144. }
  145. </style>
  146. <span class="on-the-fly-behavior"></span>
  147. <div
  148. id="homePageBackgroundImageDivStyled"
  149. class="background container-fluid"
  150. ></div>
  151. <div class="container content text-center">
  152. <img src="{{ $authorImage.RelPermalink }}"
  153. class="rounded-circle mx-auto d-block img-fluid"
  154. alt="Author Image"
  155. />
  156. <h1 class="greeting"> {{ $author.greeting }} {{ $name }}</h1>
  157. {{ if $author.subtitle }}
  158. <h2 class="greeting-subtitle">{{ $author.subtitle }}</h2>
  159. {{ end }}
  160. <div class="typing-carousel">
  161. <span id="ityped" class="ityped"></span>
  162. <span class="ityped-cursor"></span>
  163. </div>
  164. <ul id="typing-carousel-data">
  165. {{ if $author.summary }}
  166. {{ range $author.summary }}
  167. <li>{{ . }}</li>
  168. {{ end}}
  169. {{ end }}
  170. </ul>
  171. {{ if $sections }}
  172. {{ range first 1 (where (sort $sections "section.weight") ".section.enable" true) }}
  173. {{ $sectionID := replace (lower .section.name) " " "-" }}
  174. {{ if .section.id }}
  175. {{ $sectionID = .section.id }}
  176. {{ end }}
  177. <a href="#{{ $sectionID }}" class="arrow-center" aria-label="{{ i18n "read" }} {{ i18n "more" }} - {{ $name }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
  178. {{ end }}
  179. {{ end }}
  180. </div>
  181. </div>