weflock/home.hbs
Badri Sunderarajan 28cf0c81fc Showcase different tags on the homepage
Thanks to Ghost's Headline theme for the inspiration!
2023-02-13 22:42:16 +05:30

82 lines
2.7 KiB
Handlebars

{{!< default}}
{{!-- The tag above means: insert everything in this file
into the {body} of the default.hbs template --}}
<div class="site-header-content">
{{#if @site.cover_image}}
{{!-- 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 --}}
<img class="site-header-cover"
srcset="{{img_url @site.cover_image size="s"}} 300w,
{{img_url @site.cover_image size="m"}} 600w,
{{img_url @site.cover_image size="l"}} 1000w,
{{img_url @site.cover_image size="xl"}} 2000w"
sizes="100vw"
src="{{img_url @site.cover_image size="xl"}}"
alt=""
/>
{{/if}}
<h1 class="site-title">
{{#if @site.logo}}
<img class="site-logo" src="{{img_url @site.logo size="m"}}" alt="{{@site.title}}" />
{{else}}
{{@site.title}}
{{/if}}
</h1>
<p>{{@site.description}}</p>
<a class="header-cta-button" href="#/search">
<div>I want to think about...</div>
<span>Search</span>
</a>
{{#unless @member}}
<a class="header-cta-secondary" href="#/portal">
<p>{{> "icons/email"}} Think about something new every week</p>
</a>
{{/unless}}
</div>
{{!-- The main content area --}}
<main id="site-main" class="site-main outer">
<div class="inner posts">
<section>
<header class="gh-topic-header">
{{#match pagination.pages ">" 1}}
<a href="{{@site.url}}/page/2"><h2>Latest</h2></a>
{{else}}
<h2>Latest</h2>
{{/match}}
</header>
<div class="post-feed">
{{#foreach posts limit="4"}}
{{!-- The tag below includes the markup for each post - partials/post-card.hbs --}}
{{> "post-card"}}
{{/foreach}}
</div>
</section>
{{#if @custom.enter_tag_slugs}}
{{#get "tags" filter="slug:[{{@custom.enter_tag_slugs}}]"}}
{{#foreach tags}}
<hr />
{{> "topic-grid"}}
{{/foreach}}
{{/get}}
{{else}}
{{#match posts.length ">" 1}}
{{#get "tags" include="count.posts" order="count.posts desc" limit="6"}}
{{#foreach tags}}
<hr />
{{> "topic-grid"}}
{{/foreach}}
{{/get}}
{{/match}}
{{/if}}
</div>
</main>