mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
4 days ago 65dec45ece2188f814fff0d907db47fe0e6b9456
fix: add alignment option to home layout (#896)

This adds a configuration parameter for the home page layout to align
the content.

```toml
[params.ananke.home]
content_alignment = "center"
```

Default is `center` (due to it being the previous layout option).
Possible options are `left`, `right`, and `center`. This influences
_only_ the home page markdown content, not other parts of the home page.

---------

Signed-off-by: Patrick Kollitsch <83281+davidsneighbour@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2 files modified
14 ■■■■■ changed files
config/_default/params.toml 3 ●●●●● patch | view | raw | blame | history
layouts/home.html 11 ●●●●● patch | view | raw | blame | history
config/_default/params.toml
@@ -1,6 +1,9 @@
[ananke]
show_recent_posts = true # show recent posts on the homepage
[ananke.home]
content_alignment = "center" # options: left, center, right
[ananke.social]
icon_path = "ananke/socials/%s.svg"
layouts/home.html
@@ -1,5 +1,14 @@
{{ define "main" }}
  <article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }}">
  {{- $config := site.Params.ananke.home -}}
  {{- $text_alignment := "tc-l" -}}
  {{- if eq $config.content_alignment "left" -}}
    {{- $text_alignment = "tl-l" -}}
  {{- else if eq $config.content_alignment "right" -}}
    {{- $text_alignment = "tr-l" -}}
  {{- end -}}
  <article class="cf ph3 ph5-l pv3 pv4-l f4 {{ $text_alignment }} center measure-wide lh-copy nested-links {{ $.Param "text_color" | compare.Default "mid-gray" }}">
    {{ .Content }}
  </article>