homepage CLS is now reduced by reserving layout space up front and treating the particle background as a pre-sized enhancement layer.

I made three targeted changes:

 1. themes/openfreebooks/templates/base.html: added a body_class block so templates can declare first-render shell behavior.
 2. themes/openfreebooks/templates/index.html: set homepage body classes to page-home has-particle-background, so the background layering mode is present from first paint (not added later during hydration).
 3. themes/openfreebooks/sass/_layout.scss: reserved in-flow space before hydration with a fixed header shell (#site-header min-height, including mobile override), reserved marquee slot height on home (#marquee min-height), and stabilized page shell sizing (body/home main min-height behavior).
This commit is contained in:
Hananoshika Yomaru 2026-05-21 11:54:23 -07:00
parent c00f82aeb3
commit 057f2bebf2
5 changed files with 38 additions and 10 deletions

View file

@ -4,7 +4,14 @@
<title>Open Free Books</title>
<link>https://openfreebooks.org/</link>
<description>Recent updates to Open Free Books pages and live chapters.</description>
<lastBuildDate>Thu, 21 May 2026 17:54:08 GMT</lastBuildDate>
<lastBuildDate>Thu, 21 May 2026 18:40:42 GMT</lastBuildDate>
<item>
<title>Contribute</title>
<link>https://openfreebooks.org/contributing/</link>
<guid isPermaLink="true">https://openfreebooks.org/contributing/</guid>
<pubDate>Thu, 21 May 2026 18:40:42 GMT</pubDate>
<description>Contribute</description>
</item>
<item>
<title>Integer arithmetic</title>
<link>https://openfreebooks.org/math/integer-arithmetic/</link>
@ -306,13 +313,6 @@
<pubDate>Tue, 19 May 2026 19:29:49 GMT</pubDate>
<description>Search</description>
</item>
<item>
<title>Contribute</title>
<link>https://openfreebooks.org/contributing/</link>
<guid isPermaLink="true">https://openfreebooks.org/contributing/</guid>
<pubDate>Tue, 19 May 2026 12:34:25 GMT</pubDate>
<description>Contribute</description>
</item>
<item>
<title>Mathematics</title>
<link>https://openfreebooks.org/math/</link>

View file

@ -14,7 +14,7 @@
</url>
<url>
<loc>https://openfreebooks.org/contributing/</loc>
<lastmod>2026-05-19T12:34:25.000Z</lastmod>
<lastmod>2026-05-21T18:40:42.000Z</lastmod>
</url>
<url>
<loc>https://openfreebooks.org/credits/</loc>

View file

@ -16,20 +16,46 @@ html,
body {
margin: 0;
padding: 0;
min-height: 100%;
background: var(--paper);
color: var(--ink);
font-family: var(--font-body);
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
}
#site-header {
min-height: 88px;
}
@media (max-width: 768px) {
#site-header {
min-height: 82px;
}
}
.container {
width: min(1100px, 92vw);
margin: 0 auto;
}
main {
flex: 1 0 auto;
min-height: 50vh;
}
body.page-home main {
min-height: 100vh;
}
body.page-home #marquee {
min-height: 58px;
}
section {
padding: 54px 0;
}

View file

@ -33,7 +33,7 @@
></script>
{% block extra_head %}{% endblock extra_head %}
</head>
<body>
<body class="{% block body_class %}{% endblock body_class %}">
<script id="site-config" type="application/json">
{
"brand": {{ config.extra.site_title | json_encode() | safe }},

View file

@ -10,6 +10,8 @@
<div id="webgl-background" aria-hidden="true"></div>
{% endblock page_background %}
{% block body_class %}page-home has-particle-background{% endblock body_class %}
{% block content %}
<section class="hero">
<div class="container">