update content width

This commit is contained in:
ClovertaTheTrilobita 2026-09-17 13:35:59 +08:00
parent 566c5fa24a
commit 7c3bbfee42
4 changed files with 151 additions and 138 deletions

View file

@ -165,10 +165,7 @@ const t = getTranslations(lang);
width: var(--site-nav-width, auto); width: var(--site-nav-width, auto);
margin: var(--site-nav-margin, 1rem) 0; margin: var(--site-nav-margin, 1rem) 0;
padding-bottom: var(--site-nav-padding, 1rem); padding-bottom: var(--site-nav-padding, 1rem);
transform: translate( transform: translate(var(--site-nav-x, 0), var(--site-nav-y, 0));
var(--site-nav-x, 0),
var(--site-nav-y, 0)
);
} }
.site-header :global(.site-nav-desktop) { .site-header :global(.site-nav-desktop) {
@ -207,7 +204,6 @@ const t = getTranslations(lang);
font-size: clamp(1.25rem, 7vw, 2rem); font-size: clamp(1.25rem, 7vw, 2rem);
} }
} }
</style> </style>
<script> <script>
@ -330,9 +326,7 @@ const t = getTranslations(lang);
12 * rootFontSize, 12 * rootFontSize,
); );
const compactSiteNavWidth = Math.max( const compactSiteNavWidth = Math.max(
expandedWidth - expandedWidth - compactLogoWidth - 7.5 * rootFontSize,
compactLogoWidth -
7.5 * rootFontSize,
0, 0,
); );
const compactNavGap = Math.min( const compactNavGap = Math.min(
@ -406,8 +400,7 @@ const t = getTranslations(lang);
) { ) {
if (!slot) return; if (!slot) return;
const headerIsFullyExpanded = const headerIsFullyExpanded = currentScrollY >= HEADER_SCROLL_DISTANCE;
currentScrollY >= HEADER_SCROLL_DISTANCE;
slot.classList.toggle( slot.classList.toggle(
"is-footer-hidden", "is-footer-hidden",

View file

@ -18,6 +18,7 @@ const t = getTranslations(lang);
description={frontmatter.description} description={frontmatter.description}
image={frontmatter.image?.url} image={frontmatter.image?.url}
> >
<main class="post-layout">
<div id="reading-progress" aria-hidden="true"></div> <div id="reading-progress" aria-hidden="true"></div>
<a <a
href="/" href="/"
@ -90,6 +91,7 @@ const t = getTranslations(lang);
{t.post.commentsDesc.map((line: string) => <p set:html={line} />)} {t.post.commentsDesc.map((line: string) => <p set:html={line} />)}
<Remark42Embed slug={slug} /> <Remark42Embed slug={slug} />
</article> </article>
</main>
</BaseLayout> </BaseLayout>
<script <script
@ -169,6 +171,11 @@ const t = getTranslations(lang);
</script> </script>
<style> <style>
.post-layout {
max-width: 850px;
margin: 0 auto;
}
#reading-progress { #reading-progress {
position: fixed; position: fixed;
top: 0; top: 0;

View file

@ -14,10 +14,11 @@ const lang = getLangFromUrl(Astro.url);
const t = getTranslations(lang); const t = getTranslations(lang);
const headerTitle = lang === "zh" ? "Cloverta的博客" : "Cloverta's blog"; const headerTitle = lang === "zh" ? "Cloverta的博客" : "Cloverta's blog";
const pageTitle = t.home.title; const pageTitle = t.home.title;
const rssLink = lang === "zh" ? "/rss.xml" : "/en/rss.xml" const rssLink = lang === "zh" ? "/rss.xml" : "/en/rss.xml";
--- ---
<BaseLayout pageTitle=`${headerTitle} - ${t.banner.subtitle}`> <BaseLayout pageTitle=`${headerTitle} - ${t.banner.subtitle}`>
<main class="index">
<h1 class="page-title"> <h1 class="page-title">
<span>{pageTitle}</span> <span>{pageTitle}</span>
<a <a
@ -56,9 +57,15 @@ const rssLink = lang === "zh" ? "/rss.xml" : "/en/rss.xml"
<!-- <Remark42LatestComments lang={lang} client:load /> --> <!-- <Remark42LatestComments lang={lang} client:load /> -->
<LatestComments /> <LatestComments />
</main>
</BaseLayout> </BaseLayout>
<style> <style>
.index {
max-width: 850px;
margin: 0 auto;
}
.section-divider { .section-divider {
height: 1px; height: 1px;
background: #cdd2d8; background: #cdd2d8;

View file

@ -16,6 +16,7 @@ const pageTitle = lang === "zh" ? "标签索引" : "Tag Index";
--- ---
<BaseLayout pageTitle=`${pageTitle} - ${t.banner.title}`> <BaseLayout pageTitle=`${pageTitle} - ${t.banner.title}`>
<main class="tags-layout">
<h1>{t.tags.title}</h1> <h1>{t.tags.title}</h1>
<p>{t.tags.description}</p> <p>{t.tags.description}</p>
@ -28,9 +29,14 @@ const pageTitle = lang === "zh" ? "标签索引" : "Tag Index";
)) ))
} }
</div> </div>
</main>
</BaseLayout> </BaseLayout>
<style> <style>
.tags-layout {
max-width: 850px;
margin: 0 auto;
}
.tags { .tags {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;