Skip to content

Commit 3b77c40

Browse files
authored
Fixes youtube embeds and improves Lightouse audits (#24)
1 parent 15f65fa commit 3b77c40

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed

assets/built/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/built/screen.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/screen.css

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,6 @@ p {
232232
margin-left: auto;
233233
}
234234

235-
/* Embed */
236-
237-
.kg-embed-card {
238-
display: flex;
239-
flex-direction: column;
240-
align-items: center;
241-
width: 100%;
242-
}
243-
244235
/* Gallery */
245236

246237
.kg-image[width][height],
@@ -601,4 +592,12 @@ figcaption a {
601592
}
602593
#post-list {
603594
@apply grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3;
595+
}
596+
597+
/* Embed */
598+
.kg-embed-card {
599+
display: flex;
600+
flex-direction: column;
601+
align-items: center;
602+
width: 100%;
604603
}

assets/js/main.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,20 @@ document.addEventListener("keydown", function (e) {
102102
// Trigger Ghost search
103103
document.querySelector("[data-ghost-search]").click();
104104
}
105-
});
105+
});
106+
107+
/* Reframe */
108+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).reframe=t()}(this,function(){"use strict";function t(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var i=Array(e),o=0,t=0;t<n;t++)for(var r=arguments[t],f=0,d=r.length;f<d;f++,o++)i[o]=r[f];return i}return function(e,s){return void 0===s&&(s="js-reframe"),("string"==typeof e?t(document.querySelectorAll(e)):"length"in e?t(e):[e]).forEach(function(e){var t,n,i,o,r,f,d,l;-1!==e.className.split(" ").indexOf(s)||-1<e.style.width.indexOf("%")||(i=e.getAttribute("height")||e.offsetHeight,o=e.getAttribute("width")||e.offsetWidth,r=("string"==typeof i?parseInt(i):i)/("string"==typeof o?parseInt(o):o)*100,(f=document.createElement("div")).className=s,(d=f.style).position="relative",d.width="100%",d.paddingTop=r+"%",(l=e.style).position="absolute",l.width="100%",l.height="100%",l.left="0",l.top="0",null!==(t=e.parentNode)&&void 0!==t&&t.insertBefore(f,e),null!==(n=e.parentNode)&&void 0!==n&&n.removeChild(e),f.appendChild(e))})}});
109+
110+
/* Responsive video in post content */
111+
(function () {
112+
const sources = [
113+
'figure iframe[src*="youtube.com"]',
114+
'figure iframe[src*="youtube-nocookie.com"]',
115+
'figure iframe[src*="player.vimeo.com"]',
116+
'figure iframe[src*="kickstarter.com"][src*="video.html"]',
117+
'figure object',
118+
'figure embed',
119+
];
120+
reframe(document.querySelectorAll(sources.join(',')));
121+
})();

default.hbs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212

1313
{{!-- {{> "typography/noto"}} --}}
1414

15-
{{ghost_head}}
15+
{{#is "home, tag, author, index"}}
16+
{{ghost_head exclude="card_assets,cta_styles,comment_counts,announcement"}}
17+
{{else}}
18+
{{ghost_head}}
19+
{{/is}}
20+
1621
</head>
1722

1823
<body class="{{body_class}} bg-gradient-to-r from-darker via-darker to-dark">
@@ -26,7 +31,7 @@
2631
{{!-- Footer --}}
2732
{{> "components/footer"}}
2833

29-
<script src="{{asset "built/main.js"}}"></script>
34+
<script src="{{asset "built/main.js"}}" defer></script>
3035
{{ghost_foot}}
3136

3237
</body>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "sredevopsorg-ghost-theme",
33
"description": "Ghost v5 Theme made for SREDevOps.org (https://sredevops.org) based on Tailwind CSS v3, responsive, dark color schema, SVG icons, sidebar + footer navgation, customized tags and recommendations pages.",
44
"demo": "https://sredevops.org",
5-
"version": "1.1.7",
5+
"version": "1.1.8",
66
"engines": {
77
"ghost": ">=5.0.0"
88
},

partials/posts-list.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<a href="{{url absolute="true"}}" alt="{{title}}">
66
<img alt="{{title}}"
77
src="{{img_url feature_image size='s' format='webp'}}"
8+
width="220px"
89
{{#if @custom.lazy_images}} loading="lazy"{{/if}} />
910
</a>
1011
<div>
@@ -20,7 +21,7 @@
2021
</p>
2122

2223
<a href="{{url absolute="true"}}" class="inline-flex items-center gap-1 mt-4 text-sm font-medium group" alt="{{title}}" rel="bookmark">
23-
<h2 id="{{slug}}" class="block transition-all group-hover:ms-0.5" alt="{{title}}">
24+
<h2 class="block transition-all group-hover:ms-0.5" alt="{{title}}">
2425
Read the full post &rarr;
2526
</h2>
2627
</a>

0 commit comments

Comments
 (0)