From cdcd83f7241e07937daad4255bb119818d2224e5 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Tue, 11 Aug 2020 23:36:29 +0100 Subject: [PATCH] feat: experimental support for single column Pages and Contact widgets Enable single column centered layout for Pages and Contact widgets. To use this feature, add the following to the widget front matter: [design] columns = "1" See #984 --- layouts/partials/widgets/contact.html | 42 +++++++++++++++++---------- layouts/partials/widgets/pages.html | 30 ++++++++++++++----- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/layouts/partials/widgets/contact.html b/layouts/partials/widgets/contact.html index d8c6452e..d32ff77e 100644 --- a/layouts/partials/widgets/contact.html +++ b/layouts/partials/widgets/contact.html @@ -1,21 +1,31 @@ {{ $ := .root }} -{{ $page := .page }} -{{ $autolink := default true $page.Params.autolink }} +{{ $st := .page }} +{{ $autolink := default true $st.Params.autolink }} {{ $data := site.Params }} - -
-
-

{{ with $page.Title }}{{ . | markdownify }}{{ end }}

- {{ with $page.Params.subtitle }}

{{ . | markdownify }}

{{ end }} -
-
- {{ with $page.Content }}{{ . }}{{ end }} +{{ $columns := $st.Params.design.columns | default "2" }} - {{ if $page.Params.email_form }} +
+ {{ if $st.Title }} + {{ if eq $columns "1" }} +
+ {{ with $st.Title }}

{{.}}

{{ end }} + {{ with $st.Params.subtitle }}

{{ . | markdownify | emojify }}

{{ end }} +
+ {{else}} +
+ {{ with $st.Title }}

{{.}}

{{ end }} + {{ with $st.Params.subtitle }}

{{ . | markdownify | emojify }}

{{ end }} +
+ {{end}} + {{ end }} +
+ {{ with $st.Content }}{{ . }}{{ end }} + + {{ if $st.Params.email_form }} {{ $post_action := "" }} - {{ if eq $page.Params.email_form 1 }} + {{ if eq $st.Params.email_form 1 }} {{ $post_action = "netlify" }} {{ else }} {{ if not $data.email }} @@ -25,7 +35,7 @@ {{end}}
-
+
@@ -38,12 +48,12 @@
- {{ if eq $page.Params.email_form 1 }} + {{ if eq $st.Params.email_form 1 }}
{{ end }} - {{ if $page.Params.netlify.captcha }} + {{ if $st.Params.netlify.captcha }}
{{ end }} @@ -53,7 +63,7 @@
    - {{ if and $data.email (not $page.Params.email_form) }} + {{ if and $data.email (not $st.Params.email_form) }}
  • diff --git a/layouts/partials/widgets/pages.html b/layouts/partials/widgets/pages.html index 3973229e..1fa73f1d 100644 --- a/layouts/partials/widgets/pages.html +++ b/layouts/partials/widgets/pages.html @@ -69,11 +69,22 @@ {{ $i18n = "more_pages" }} {{ end }} -
    -
    -

    {{ with $st.Title }}{{ . | markdownify | emojify }}{{ end }}

    - {{ with $st.Params.subtitle }}

    {{ . | markdownify | emojify }}

    {{ end }} -
    +{{ $columns := $st.Params.design.columns | default "2" }} + +
    + {{ if $st.Title }} + {{ if eq $columns "1" }} +
    + {{ with $st.Title }}

    {{.}}

    {{ end }} + {{ with $st.Params.subtitle }}

    {{ . | markdownify | emojify }}

    {{ end }} +
    + {{else}} +
    + {{ with $st.Title }}

    {{.}}

    {{ end }} + {{ with $st.Params.subtitle }}

    {{ . | markdownify | emojify }}

    {{ end }} +
    + {{end}} + {{ end }}
    {{ with $st.Content }}{{ . }}{{ end }} @@ -90,10 +101,13 @@ {{ end }} {{end}} - {{ if gt $count $items_count }} + {{ $show_archive_link := $st.Params.content.archive.enable | default (gt $count $items_count) }} + {{ if $show_archive_link }} + {{ $archive_link := ($st.Params.content.archive.link | relLangURL) | default $archive_page.RelPermalink }} + {{ $archive_text := $st.Params.content.archive.text | default (i18n $i18n) | default "See all" }}