home.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. {{ $authorImage:= "/images/default-avatar.png" }}
  20. {{ if $author.image }}
  21. {{ $authorImage = $author.image }}
  22. {{ end }}
  23. {{ $authorImage := resources.Get $authorImage }}
  24. {{/* apply image processing. don't use "Fit" in svg or gif because its not supported */}}
  25. {{ if and $authorImage (and (ne $authorImage.MediaType.SubType "svg") ( ne $authorImage.MediaType.SubType "gif")) }}
  26. {{ $authorImage = $authorImage.Fit "148x148" }}
  27. {{ end }}
  28. {{/* get file that matches the filename as specified as src="" in shortcode */}}
  29. {{ $src := resources.Get $backgroundImage }}
  30. {{/* set image sizes, these are hardcoded for now, x dictates that images are resized to this width */}}
  31. {{ $tinyw := default "500x" }}
  32. {{ $smallw := default "800x" }}
  33. {{ $mediumw := default "1200x" }}
  34. {{ $largew := default "1500x" }}
  35. {{/* resize the src image to the given sizes */}}
  36. {{ $tiny := $src.Resize $tinyw }}
  37. {{ $small := $src.Resize $smallw }}
  38. {{ $medium := $src.Resize $mediumw }}
  39. {{ $large := $src.Resize $largew }}
  40. {{/* only use images smaller than or equal to the src (original) image size, as Hugo will upscale small images */}}
  41. {{/* set the sizes attribute to (min-width: 35em) 1200px, 100vw unless overridden in shortcode */}}
  42. {{ if lt $src.Width "500" }}
  43. {{ $tiny := $src}}
  44. {{ $small := $src}}
  45. {{ $medium := $src}}
  46. {{ $large := $src}}
  47. {{ end }}
  48. {{ if lt $src.Width "800" }}
  49. {{ $small := $src}}
  50. {{ $medium := $src}}
  51. {{ $large := $src}}
  52. {{ end }}
  53. {{ if lt $src.Width "1200" }}
  54. {{ $medium := $src}}
  55. {{ $large := $src}}
  56. {{ end }}
  57. {{ if lt $src.Width "1500" }}
  58. {{ $large := $src}}
  59. {{ end }}
  60. <div class="container-fluid home" id="home">
  61. <style>
  62. /* 0 to 299 */
  63. #homePageBackgroundImageDivStyled {
  64. background-image: url('{{ $tiny.RelPermalink }}');
  65. }
  66. /* 300 to X */
  67. @media (min-width: 500px) and (max-width: 800px) { /* or 301 if you want really the same as previously. */
  68. #homePageBackgroundImageDivStyled {
  69. background-image: url('{{ $small.RelPermalink }}');
  70. }
  71. }
  72. @media (min-width: 801px) and (max-width: 1200px) { /* or 301 if you want really the same as previously. */
  73. #homePageBackgroundImageDivStyled {
  74. background-image: url('{{ $medium.RelPermalink }}');
  75. }
  76. }
  77. @media (min-width: 1201px) and (max-width: 1500px) { /* or 301 if you want really the same as previously. */
  78. #homePageBackgroundImageDivStyled {
  79. background-image: url('{{ $large.RelPermalink }}');
  80. }
  81. }
  82. @media (min-width: 1501px) { /* or 301 if you want really the same as previously. */
  83. #homePageBackgroundImageDivStyled {
  84. background-image: url('{{ $src.RelPermalink }}');
  85. }
  86. }
  87. </style>
  88. <span class="on-the-fly-behavior"></span>
  89. <div
  90. id="homePageBackgroundImageDivStyled"
  91. class="background container-fluid"
  92. ></div>
  93. <div class="container content text-center">
  94. <img src="{{ $authorImage.RelPermalink }}"
  95. class="rounded-circle mx-auto d-block img-fluid"
  96. alt="Author Image"
  97. />
  98. <h1 class="greeting"> {{ $author.greeting }} {{ $name }}</h1>
  99. {{ if $author.subtitle }}
  100. <h2 class="greeting-subtitle">{{ $author.subtitle }}</h2>
  101. {{ end }}
  102. <div class="typing-carousel">
  103. <span id="ityped" class="ityped"></span>
  104. <span class="ityped-cursor"></span>
  105. </div>
  106. <ul id="typing-carousel-data">
  107. {{ if $author.summary }}
  108. {{ range $author.summary }}
  109. <li>{{ . }}</li>
  110. {{ end}}
  111. {{ end }}
  112. </ul>
  113. {{ if $sections }}
  114. {{ range first 1 (where (sort $sections "section.weight") ".section.enable" true) }}
  115. {{ $sectionID := replace (lower .section.name) " " "-" }}
  116. {{ if .section.id }}
  117. {{ $sectionID = .section.id }}
  118. {{ end }}
  119. <a href="#{{ $sectionID }}" class="arrow-center" aria-label="{{ i18n "read" }} {{ i18n "more" }} - {{ $name }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
  120. {{ end }}
  121. {{ end }}
  122. </div>
  123. </div>