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