diff options
author | Curtis Timson <curt@live.co.uk> | 2022-04-07 14:15:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 14:15:47 +0300 |
commit | e5423a2561e3ec8acdf38c75a9b2e9ee72dec32c (patch) | |
tree | 7d1bf0edb554c53d3ebd482c3447d21715740983 | |
parent | 15dc7632f64f95cc9d0b5befa0d81defe12e1fe5 (diff) |
🔧 Hugo config.toml (#106)
* 🔧 Hugo config.toml
* trim whitespace on output
* fix e2e test
-rw-r--r-- | config.toml | 4 | ||||
-rw-r--r-- | cypress/integration/home.test.ts | 3 | ||||
-rw-r--r-- | layouts/index.html | 74 | ||||
-rw-r--r-- | layouts/partials/intro.html | 14 |
4 files changed, 50 insertions, 45 deletions
diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..d9669b9 --- /dev/null +++ b/config.toml @@ -0,0 +1,4 @@ +[module] + [module.hugoVersion] + min = "0.54.0" + max = "0.94.2"
\ No newline at end of file diff --git a/cypress/integration/home.test.ts b/cypress/integration/home.test.ts index ab3a1d7..aa55b1c 100644 --- a/cypress/integration/home.test.ts +++ b/cypress/integration/home.test.ts @@ -5,7 +5,8 @@ describe('Home', () => { it('displays title', () => { cy.get('h1') - .contains('This is Massively'); + .contains('This is') + .contains('Massively'); }); }); diff --git a/layouts/index.html b/layouts/index.html index a79b083..9eaee66 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,67 +1,67 @@ {{ partial "htmlhead" . }} <body lang='{{ .Site.Language.Lang | default "en-us" }}' class="is-preload"> - {{ $postsFoldername := .Site.Params.Posts.foldername | default "post" }} - {{ $postsPageSize := .Site.Params.Posts.pagesize | default 6 }} + {{- $postsFoldername := .Site.Params.Posts.foldername | default "post" }} + {{- $postsPageSize := .Site.Params.Posts.pagesize | default 6 }} - {{ .Scratch.Set "postsFeaturedPostEnabled" true }} - {{ if (or (eq .Site.Params.Posts.featuredpost "false") (eq .Site.Params.Posts.featuredpost false)) }} - {{ .Scratch.Set "postsFeaturedPostEnabled" false }} - {{ end }} - {{ $postsFeaturedPostEnabled := .Scratch.Get "postsFeaturedPostEnabled" }} + {{- .Scratch.Set "postsFeaturedPostEnabled" true }} + {{- if (or (eq .Site.Params.Posts.featuredpost "false") (eq .Site.Params.Posts.featuredpost false)) }} + {{- .Scratch.Set "postsFeaturedPostEnabled" false }} + {{- end }} + {{- $postsFeaturedPostEnabled := .Scratch.Get "postsFeaturedPostEnabled" }} - {{ $posts := where .Data.Pages "Type" $postsFoldername }} + {{- $posts := where .Data.Pages "Type" $postsFoldername }} - {{ if .IsHome }} - {{ $posts = .Site.RegularPages }} - {{ end }} + {{- if .IsHome }} + {{- $posts = .Site.RegularPages }} + {{- end }} - {{ $firstPost := first 1 $posts }} + {{- $firstPost := first 1 $posts }} - {{ if and (eq $postsFeaturedPostEnabled true) (gt (len $posts) 1) }} - {{ .Scratch.Set "postsForPaging" (after 1 $posts) }} - {{ else }} - {{ .Scratch.Set "postsForPaging" $posts }} - {{ end }} - {{ $postsForPaging := .Scratch.Get "postsForPaging" }} + {{- if and (eq $postsFeaturedPostEnabled true) (gt (len $posts) 1) -}} + {{- .Scratch.Set "postsForPaging" (after 1 $posts) }} + {{- else }} + {{- .Scratch.Set "postsForPaging" $posts }} + {{- end -}} + {{- $postsForPaging := .Scratch.Get "postsForPaging" -}} - {{ $postsPaging := .Paginate $postsForPaging $postsPageSize }} + {{- $postsPaging := .Paginate $postsForPaging $postsPageSize -}} <!-- Wrapper --> <div id="wrapper" class="fade-in" data-pfn="{{ $postsFoldername }}" data-ps="{{ $postsPageSize }}" data-pfp="{{ $postsFeaturedPostEnabled }}"> - {{ if eq $postsPaging.PageNumber 1 }} - {{ partial "intro.html" . }} - {{ end }} + {{- if eq $postsPaging.PageNumber 1 -}} + {{- partial "intro.html" . -}} + {{- end -}} - {{ partial "header" . }} - {{ partial "nav" . }} + {{- partial "header" . -}} + {{- partial "nav" . }} <!-- Main --> <div id="main"> - {{ if (eq $postsFeaturedPostEnabled true) }} - {{ partial "posts/featured.html" (dict "firstpost" $firstPost "siteData" (index .Site.Data .Site.Language.Lang)) }} - {{ end }} + {{- if (eq $postsFeaturedPostEnabled true) }} + {{- partial "posts/featured.html" (dict "firstpost" $firstPost "siteData" (index .Site.Data .Site.Language.Lang)) }} + {{- end }} - {{ if (not (and (eq (len $posts) 1) (eq $postsFeaturedPostEnabled true))) }} - {{ partial "posts/list.html" (dict "posts" $postsPaging "siteData" (index .Site.Data .Site.Language.Lang)) }} - {{ end }} + {{- if (not (and (eq (len $posts) 1) (eq $postsFeaturedPostEnabled true))) }} + {{- partial "posts/list.html" (dict "posts" $postsPaging "siteData" (index .Site.Data .Site.Language.Lang)) }} + {{- end }} - {{ $paginator := .Paginator }} - {{ $outer := . }} - {{ partial "posts/pagination.html" (dict "paginator" $paginator "outer" $outer)}} + {{- $paginator := .Paginator }} + {{- $outer := . }} + {{- partial "posts/pagination.html" (dict "paginator" $paginator "outer" $outer)}} </div> - {{ partial "footer/index" . }} - {{ partial "copyright" . }} + {{- partial "footer/index" . }} + {{- partial "copyright" . }} <a href="#navPanel" id="navPanelToggle">{{ i18n "NAV_MENU" . }}</a> </div> - {{ template "_internal/google_analytics.html" . }} - {{ partial "scripts/index" . }} + {{- template "_internal/google_analytics.html" . }} + {{- partial "scripts/index" . }} </body> </html> diff --git a/layouts/partials/intro.html b/layouts/partials/intro.html index f22fa60..fd9ed5a 100644 --- a/layouts/partials/intro.html +++ b/layouts/partials/intro.html @@ -2,17 +2,17 @@ {{ with $data.intro }} <div id="intro"> <h1> - {{ range $i, $e := .title }} - {{ if $i }} <br/> {{ end }} {{ .line }} - {{ end }} + {{- range $i, $e := .title -}} + {{- if $i -}}<br/>{{- end -}} {{- .line -}} + {{- end -}} </h1> <p> - {{ range $i, $e := .description }} - {{ if $i }} <br/> {{ end }} {{ .line }} - {{ end }} + {{- range $i, $e := .description -}} + {{- if $i -}}<br/>{{- end -}} {{- .line -}} + {{- end -}} </p> <ul class="actions"> <li><a href="#header" class="button icon solo fa-arrow-down scrolly">{{ i18n "INTRO_CONTINUE" . }}</a></li> </ul> </div> -{{ end }} +{{- end -}} |