Skip to content

Improve srcsets and add where missing #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@

{{#is "home"}}
{{#if @site.cover_image}}
{{#match @custom.header_section_layout "Large background"}}
<link rel="preload" as="image" href="{{@site.cover_image}}">
{{else match @custom.header_section_layout "Side by side"}}
<link rel="preload" as="image" href="{{img_url @site.cover_image size="m"}}">
{{/match}}

{{/if}}
{{/is}}

Expand Down Expand Up @@ -45,7 +50,11 @@
<div class="gh-head-brand-wrapper">
<a class="gh-head-logo" href="{{@site.url}}">
{{#if @site.logo}}
<img src="{{@site.logo}}" alt="{{@site.title}}">
<img srcset="{{img_url @site.logo size="s"}} 300w,
{{img_url @site.logo size="m"}} 720w"
sizes="90vw"
src="{{img_url @site.logo size="s"}}" alt="{{@site.title}}"
>
{{else}}
{{@site.title}}
{{/if}}
Expand Down
23 changes: 20 additions & 3 deletions index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@
<section class="gh-about gh-outer{{#match @custom.header_section_layout "!=" "Typographic profile"}}{{#unless @site.cover_image}} no-image{{/unless}}{{else}}{{#unless @site.icon}} no-image{{/unless}}{{/match}}">
<div class="gh-about-inner gh-inner">
{{#match @custom.header_section_layout "!=" "Typographic profile"}}
{{#if @site.cover_image}}
<img class="gh-about-image" src="{{@site.cover_image}}" alt="{{@site.title}}">
{{/if}}
{{#match @custom.header_section_layout "=" "Large background"}}
{{#if @site.cover_image}}
<img class="gh-about-image"
srcset="{{img_url @site.cover_image size="s"}} 300w,
{{img_url @site.cover_image size="m"}} 720w,
{{img_url @site.cover_image size="l"}} 960w,
{{img_url @site.cover_image size="xl"}} 1200w,
{{img_url @site.cover_image size="xxl"}} 2000w"
sizes="100vw"
src="{{@site.cover_image}}" alt="{{@site.title}}">
{{/if}}
{{else}}
{{#if @site.cover_image}}
<img class="gh-about-image"
srcset="{{img_url @site.cover_image size="s"}} 300w,
{{img_url @site.cover_image size="m"}} 720w"
sizes="(max-width: 720px) 100vw, 50vw"
src="{{@site.cover_image}}" alt="{{@site.title}}">
{{/if}}
{{/match}}
{{else}}
{{#if @site.icon}}
<img class="gh-about-image" src="{{@site.icon}}" alt="{{@site.title}}">
Expand Down
10 changes: 7 additions & 3 deletions partials/loop.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
{{#match @custom.post_feed_layout "Parallax"}}class="jarallax-img"{{/match}}
srcset="{{img_url feature_image size="s"}} 300w,
{{img_url feature_image size="m"}} 720w,
{{img_url feature_image size="l"}} 960w,
{{img_url feature_image size="l"}} 960w
{{#match @custom.post_feed_layout "=" "Parallax"}},
{{img_url feature_image size="xl"}} 1200w,
{{img_url feature_image size="xxl"}} 2000w"
sizes="(max-width: 1200px) 100vw, 1200px"
{{img_url feature_image size="xxl"}} 2000w
" sizes="(max-width: 1440px) 100vw, 1440px"
{{else}}
" sizes="(max-width: 991px) 100vw, 50vw"
{{/match}}
src="{{img_url feature_image size="m"}}"
alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}"
>
Expand Down