mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 03:32:51 +02:00
chore: optimize styles and update dependencies
- Fix random sorting issue in RSS articles - Optimize RSS style file - Improve scrollbar styles - Upgrade project dependencies
This commit is contained in:
parent
e757da729a
commit
b492e5c262
10 changed files with 741 additions and 548 deletions
|
@ -20,8 +20,8 @@ const showLanguageSwitcher = moreLocales.length > 0
|
|||
const useSupportedLangs = isPost || (isTag && supportedLangs.length > 0)
|
||||
// Choose a language switch list according to the page type
|
||||
const nextUrl = useSupportedLangs
|
||||
? getNextSupportedLangPath(currentPath, supportedLangs) // Switch between supported languages
|
||||
: getNextGlobalLangPath(currentPath) // Switch between all languages
|
||||
? getNextSupportedLangPath(currentPath, supportedLangs) // Switch between supported languages in post/tag page
|
||||
: getNextGlobalLangPath(currentPath) // Switch between all languages in other pages
|
||||
---
|
||||
|
||||
<div
|
||||
|
|
|
@ -53,7 +53,7 @@ function setupScrollbar() {
|
|||
}, {
|
||||
scrollbars: {
|
||||
theme: 'scrollbar-widget',
|
||||
autoHide: 'leave',
|
||||
autoHide: 'never',
|
||||
autoHideDelay: 500,
|
||||
},
|
||||
overflow: {
|
||||
|
@ -89,17 +89,17 @@ document.addEventListener('astro:after-swap', setupScrollbar)
|
|||
}
|
||||
|
||||
.scrollbar-widget {
|
||||
--os-size: 0.35rem;
|
||||
--os-padding-perpendicular: 0;
|
||||
--os-padding-axis: 0;
|
||||
--os-size: 0.6rem;
|
||||
--os-padding-perpendicular: 0.1rem;
|
||||
--os-padding-axis: 0.2rem;
|
||||
--os-handle-border-radius: 99rem;
|
||||
--os-handle-perpendicular-size: 75%;
|
||||
--os-handle-perpendicular-size-hover: 100%;
|
||||
--os-handle-perpendicular-size-active: 100%;
|
||||
--os-handle-interactive-area-offset: 0.1rem;
|
||||
--os-handle-interactive-area-offset: 0.2rem;
|
||||
--os-handle-bg: oklch(var(--un-preset-theme-colors-secondary) / 0.15);
|
||||
--os-handle-bg-hover: oklch(var(--un-preset-theme-colors-secondary) / 0.25);
|
||||
--os-handle-bg-active: oklch(var(--un-preset-theme-colors-secondary) / 0.25);
|
||||
--os-handle-bg-hover: oklch(var(--un-preset-theme-colors-secondary) / 0.30);
|
||||
--os-handle-bg-active: oklch(var(--un-preset-theme-colors-secondary) / 0.30);
|
||||
--os-handle-min-size: 12%;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ const filteredHeadings = headings.filter(heading =>
|
|||
}
|
||||
|
||||
.accordion-content {
|
||||
--at-apply: 'overflow-hidden max-h-66 lg:max-h-82 2xl:(max-h-[calc(100vh-21.5rem)]) px-4';
|
||||
--at-apply: 'overflow-hidden max-h-66 lg:max-h-82 2xl:(max-h-[calc(100vh-21.5rem)]) pl-4 pr-6';
|
||||
}
|
||||
|
||||
/* When toggle is checked, expand the wrapper to show content */
|
||||
|
|
|
@ -13,7 +13,7 @@ export const langMap: Record<string, string[]> = {
|
|||
export const walineLocaleMap: Record<string, string> = {
|
||||
'zh': 'zh-CN',
|
||||
'zh-tw': 'zh-TW',
|
||||
'ja': 'jp-JP', // Waline uses jp-JP not ja-JP
|
||||
'ja': 'jp-JP', // Waline uses jp-JP instead of ja-JP
|
||||
'en': 'en-US',
|
||||
'es': 'es-ES',
|
||||
'ru': 'ru-RU',
|
||||
|
|
|
@ -23,7 +23,7 @@ const { isPost } = getPageInfo(Astro.url.pathname)
|
|||
const fontStyle = themeConfig.global.fontStyle === 'serif' ? 'font-serif' : 'font-sans'
|
||||
const MarginBottom = isPost && themeConfig.comment?.enabled
|
||||
? 'mb-10' // Post page with comment system
|
||||
: 'mb-12' // Other pages
|
||||
: 'mb-12' // Other pages without comment system
|
||||
---
|
||||
|
||||
<html
|
||||
|
|
|
@ -27,11 +27,16 @@ export async function generateRSS({ lang }: GenerateRSSOptions = {}) {
|
|||
(!data.draft && (data.lang === lang || data.lang === '' || (lang === undefined && data.lang === defaultLocale))),
|
||||
)
|
||||
|
||||
// Sort posts by published date in descending order
|
||||
const sortedPosts = [...posts].sort((a, b) =>
|
||||
new Date(b.data.published).getTime() - new Date(a.data.published).getTime(),
|
||||
)
|
||||
|
||||
return rss({
|
||||
title: siteTitle,
|
||||
site: lang ? `${url}/${lang}` : url,
|
||||
description: siteDescription,
|
||||
stylesheet: '/rss/rss-style.min.xsl',
|
||||
stylesheet: '/rss/rss-style.xsl',
|
||||
customData: `
|
||||
<copyright>Copyright © ${new Date().getFullYear()} ${themeConfig.site.author}</copyright>
|
||||
<language>${lang || themeConfig.global.locale}</language>
|
||||
|
@ -44,7 +49,7 @@ export async function generateRSS({ lang }: GenerateRSSOptions = {}) {
|
|||
: ''
|
||||
}
|
||||
`.trim(),
|
||||
items: posts.map((post: CollectionEntry<'posts'>) => ({
|
||||
items: sortedPosts.map((post: CollectionEntry<'posts'>) => ({
|
||||
title: post.data.title,
|
||||
// Generate URL with language prefix and abbrlink/slug
|
||||
link: new URL(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue