Added support for hidden title and feature image on pages (#943)

* Added support for hidden title and feature image on pages

Refs https://github.com/TryGhost/Product/issues/3568

* Switched from match to if helper for show_title_and_feature_image

Refs https://github.com/TryGhost/Product/issues/3568
This commit is contained in:
Sanne de Vries 2023-07-10 12:19:00 +02:00 committed by GitHub
parent 4ae190c1a6
commit d3483498d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,30 +10,32 @@ into the {body} tag of the default.hbs template --}}
<main id="site-main" class="site-main"> <main id="site-main" class="site-main">
<article class="article {{post_class}}"> <article class="article {{post_class}}">
<header class="article-header gh-canvas"> {{#if show_title_and_feature_image}}
<header class="article-header gh-canvas">
<h1 class="article-title">{{title}}</h1> <h1 class="article-title">{{title}}</h1>
{{#if feature_image}} {{#if feature_image}}
<figure class="article-image"> <figure class="article-image">
{{!-- This is a responsive image, it loads different sizes depending on device {{!-- This is a responsive image, it loads different sizes depending on device
https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}} https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}}
<img <img
srcset="{{img_url feature_image size="s"}} 300w, srcset="{{img_url feature_image size="s"}} 300w,
{{img_url feature_image size="m"}} 600w, {{img_url feature_image size="m"}} 600w,
{{img_url feature_image size="l"}} 1000w, {{img_url feature_image size="l"}} 1000w,
{{img_url feature_image size="xl"}} 2000w" {{img_url feature_image size="xl"}} 2000w"
sizes="(min-width: 1400px) 1400px, 92vw" sizes="(min-width: 1400px) 1400px, 92vw"
src="{{img_url feature_image size="xl"}}" src="{{img_url feature_image size="xl"}}"
alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}" alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}"
/> />
{{#if feature_image_caption}} {{#if feature_image_caption}}
<figcaption>{{feature_image_caption}}</figcaption> <figcaption>{{feature_image_caption}}</figcaption>
{{/if}} {{/if}}
</figure> </figure>
{{/if}} {{/if}}
</header> </header>
{{/if}}
<section class="gh-content gh-canvas"> <section class="gh-content gh-canvas">
{{content}} {{content}}