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
18
package.json
18
package.json
|
@ -18,8 +18,8 @@
|
||||||
"@astrojs/rss": "^4.0.11",
|
"@astrojs/rss": "^4.0.11",
|
||||||
"@astrojs/sitemap": "^3.3.0",
|
"@astrojs/sitemap": "^3.3.0",
|
||||||
"@waline/client": "^3.5.6",
|
"@waline/client": "^3.5.6",
|
||||||
"astro": "^5.5.6",
|
"astro": "^5.6.1",
|
||||||
"astro-compress": "^2.3.7",
|
"astro-compress": "^2.3.8",
|
||||||
"astro-og-canvas": "^0.7.0",
|
"astro-og-canvas": "^0.7.0",
|
||||||
"astro-robots-txt": "^1.0.0",
|
"astro-robots-txt": "^1.0.0",
|
||||||
"canvaskit-wasm": "^0.40.0",
|
"canvaskit-wasm": "^0.40.0",
|
||||||
|
@ -39,18 +39,18 @@
|
||||||
"@types/markdown-it": "^14.1.2",
|
"@types/markdown-it": "^14.1.2",
|
||||||
"@types/node": "^22.14.0",
|
"@types/node": "^22.14.0",
|
||||||
"@types/sanitize-html": "^2.15.0",
|
"@types/sanitize-html": "^2.15.0",
|
||||||
"@unocss/eslint-plugin": "66.1.0-beta.8",
|
"@unocss/eslint-plugin": "66.1.0-beta.10",
|
||||||
"@unocss/preset-attributify": "66.1.0-beta.8",
|
"@unocss/preset-attributify": "66.1.0-beta.10",
|
||||||
"@unocss/reset": "66.1.0-beta.8",
|
"@unocss/reset": "66.1.0-beta.10",
|
||||||
"astro-eslint-parser": "^1.2.2",
|
"astro-eslint-parser": "^1.2.2",
|
||||||
"eslint": "^9.23.0",
|
"eslint": "^9.24.0",
|
||||||
"eslint-plugin-astro": "^1.3.1",
|
"eslint-plugin-astro": "^1.3.1",
|
||||||
"lint-staged": "^15.5.0",
|
"lint-staged": "^15.5.0",
|
||||||
"mdast-util-to-string": "^4.0.0",
|
"mdast-util-to-string": "^4.0.0",
|
||||||
"reading-time": "^1.5.0",
|
"reading-time": "^1.5.0",
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.34.0",
|
||||||
"typescript": "~5.8.2",
|
"typescript": "~5.8.3",
|
||||||
"unocss": "66.1.0-beta.8",
|
"unocss": "66.1.0-beta.10",
|
||||||
"unocss-preset-theme": "^0.14.1"
|
"unocss-preset-theme": "^0.14.1"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
|
1167
pnpm-lock.yaml
generated
1167
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -10,75 +10,49 @@
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
/* Basic normalization styles */
|
/* Basic styles */
|
||||||
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
|
html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
|
||||||
body{margin:0}
|
body{margin:0;font-family:ui-sans-serif,system-ui,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji';font-size:16px;line-height:1.5;word-wrap:break-word}
|
||||||
article,aside,details,figcaption,figure,footer,header,main,menu,nav,section{display:block}
|
|
||||||
summary{display:list-item}
|
|
||||||
a{background-color:transparent}
|
|
||||||
a:active,a:hover{outline-width:0}
|
|
||||||
b,strong{font-weight:bolder}
|
|
||||||
h1{font-size:2em;margin:.67em 0}
|
|
||||||
img{border-style:none}
|
|
||||||
svg:not(:root){overflow:hidden}
|
|
||||||
|
|
||||||
/* Basic box model */
|
|
||||||
*{box-sizing:border-box}
|
*{box-sizing:border-box}
|
||||||
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:14px;line-height:1.5;color:#24292e}
|
p{margin-top:0;margin-bottom:16px}
|
||||||
|
strong{font-weight:600}
|
||||||
|
small{font-size:90%}
|
||||||
|
h1,h2,h3,h4,h5,h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}
|
||||||
|
h1{padding-bottom:.3em;font-size:2em;border-bottom:1px solid #E0DFE3}
|
||||||
|
h2{padding-bottom:.3em;font-size:1.5em;border-bottom:1px solid #E0DFE3}
|
||||||
|
h3{font-size:1.25em;margin-top:0;margin-bottom:0}
|
||||||
a{color:#0366d6;text-decoration:none}
|
a{color:#0366d6;text-decoration:none}
|
||||||
a:hover{text-decoration:underline}
|
a:hover{text-decoration:underline}
|
||||||
b,strong{font-weight:600}
|
|
||||||
|
|
||||||
/* Heading styles */
|
|
||||||
h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:0;font-weight:600;line-height:1.25}
|
|
||||||
h1{font-size:32px}
|
|
||||||
h2{font-size:24px}
|
|
||||||
h3{font-size:20px}
|
|
||||||
p{margin-top:0;margin-bottom:10px}
|
|
||||||
small{font-size:90%}
|
|
||||||
|
|
||||||
/* Utility classes */
|
/* Utility classes */
|
||||||
.bg-white{background-color:#F2F1F5!important}
|
.bg-white{background-color:oklch(0.96 0.005 298)!important}
|
||||||
.container-md{max-width:768px;margin-right:auto;margin-left:auto}
|
|
||||||
.px-4{padding-right:24px!important;padding-left:24px!important}
|
.px-4{padding-right:24px!important;padding-left:24px!important}
|
||||||
.py-2{padding-top:8px!important;padding-bottom:8px!important}
|
.py-2{padding-top:8px!important;padding-bottom:8px!important}
|
||||||
.py-5{padding-top:32px!important;padding-bottom:32px!important}
|
.py-5{padding-top:32px!important;padding-bottom:32px!important}
|
||||||
.pb-3{padding-bottom:16px!important}
|
.pb-3{padding-bottom:16px!important}
|
||||||
.pb-5{padding-bottom:32px!important}
|
.pb-5{padding-bottom:32px!important}
|
||||||
.mt-2{margin-top:8px!important}
|
|
||||||
.mt-3{margin-top:16px!important}
|
.mt-3{margin-top:16px!important}
|
||||||
.mb-1{margin-bottom:4px!important}
|
.mb-1{margin-bottom:4px!important}
|
||||||
.pr-1{padding-right:4px!important}
|
.pr-1{padding-right:4px!important}
|
||||||
.border-0{border:0!important}
|
.border-0{border:0!important}
|
||||||
.text-gray{color:#586069!important}
|
.text-gray{color:oklch(0.25 0.005 298 / 75%)!important}
|
||||||
|
|
||||||
/* Responsive classes */
|
|
||||||
@media (min-width:768px){
|
@media (min-width:768px){
|
||||||
.mt-md-5{margin-top:32px!important}
|
.mt-md-5{margin-top:32px!important}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Markdown body styles */
|
/* Component styles */
|
||||||
.markdown-body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:16px;line-height:1.5;word-wrap:break-word}
|
.markdown{max-width:768px;margin-right:auto;margin-left:auto}
|
||||||
.markdown-body::before{display:table;content:""}
|
.markdown>*:first-child{margin-top:0!important}
|
||||||
.markdown-body::after{display:table;clear:both;content:""}
|
.markdown>*:last-child{margin-bottom:0!important}
|
||||||
.markdown-body>*:first-child{margin-top:0!important}
|
|
||||||
.markdown-body>*:last-child{margin-bottom:0!important}
|
|
||||||
.markdown-body a:not([href]){color:inherit;text-decoration:none}
|
|
||||||
.markdown-body p{margin-top:0;margin-bottom:16px}
|
|
||||||
.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}
|
|
||||||
.markdown-body h1{padding-bottom:.3em;font-size:2em;border-bottom:1px solid #E0DFE3}
|
|
||||||
.markdown-body h2{padding-bottom:.3em;font-size:1.5em;border-bottom:1px solid #E0DFE3}
|
|
||||||
.markdown-body h3{font-size:1.25em}
|
|
||||||
.markdown-body img{max-width:100%;box-sizing:content-box;background-color:#fff}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-white">
|
<body class="bg-white">
|
||||||
<nav class="container-md px-4 py-2 mt-3 mt-md-5 markdown-body">
|
<nav class="px-4 py-2 mt-3 mt-md-5 markdown">
|
||||||
<p>
|
<p>
|
||||||
<strong>This is a web feed,</strong> also known as an RSS feed. <strong>Subscribe</strong> by copying the URL from the address bar into your newsreader.
|
<strong>This is a web feed,</strong> also known as an RSS feed. <strong>Subscribe</strong> by copying the URL from the address bar into your newsreader.
|
||||||
</p>
|
</p>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="container-md px-4 pb-3 markdown-body">
|
<div class="px-4 pb-3 markdown">
|
||||||
<header class="py-5">
|
<header class="py-5">
|
||||||
<h1 class="border-0">
|
<h1 class="border-0">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="vertical-align: text-bottom; width: 1.2em; height: 1.2em;" class="pr-1" id="RSSicon" viewBox="0 0 256 256">
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" style="vertical-align: text-bottom; width: 1.2em; height: 1.2em;" class="pr-1" id="RSSicon" viewBox="0 0 256 256">
|
||||||
|
@ -97,12 +71,11 @@
|
||||||
<path d="M160 213h-34a82 82 0 0 0 -82 -82v-34a116 116 0 0 1 116 116z" fill="#FFF"/>
|
<path d="M160 213h-34a82 82 0 0 0 -82 -82v-34a116 116 0 0 1 116 116z" fill="#FFF"/>
|
||||||
<path d="M184 213A140 140 0 0 0 44 73 V 38a175 175 0 0 1 175 175z" fill="#FFF"/>
|
<path d="M184 213A140 140 0 0 0 44 73 V 38a175 175 0 0 1 175 175z" fill="#FFF"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
Web Feed Preview
|
Web Feed Preview
|
||||||
</h1>
|
</h1>
|
||||||
<h2><xsl:value-of select="/rss/channel/title"/></h2>
|
<h2><xsl:value-of select="/rss/channel/title"/></h2>
|
||||||
<p><xsl:value-of select="/rss/channel/description"/></p>
|
<p><xsl:value-of select="/rss/channel/description"/></p>
|
||||||
<a class="head_link" target="_blank">
|
<a target="_blank">
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="/rss/channel/link"/>
|
<xsl:value-of select="/rss/channel/link"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
|
@ -123,13 +96,10 @@
|
||||||
<small class="text-gray">
|
<small class="text-gray">
|
||||||
Published: <xsl:value-of select="substring(pubDate, 1, 16)" />
|
Published: <xsl:value-of select="substring(pubDate, 1, 16)" />
|
||||||
</small>
|
</small>
|
||||||
<div class="description mt-2">
|
|
||||||
<xsl:value-of select="description" disable-output-escaping="yes" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
|
@ -20,8 +20,8 @@ const showLanguageSwitcher = moreLocales.length > 0
|
||||||
const useSupportedLangs = isPost || (isTag && supportedLangs.length > 0)
|
const useSupportedLangs = isPost || (isTag && supportedLangs.length > 0)
|
||||||
// Choose a language switch list according to the page type
|
// Choose a language switch list according to the page type
|
||||||
const nextUrl = useSupportedLangs
|
const nextUrl = useSupportedLangs
|
||||||
? getNextSupportedLangPath(currentPath, supportedLangs) // Switch between supported languages
|
? getNextSupportedLangPath(currentPath, supportedLangs) // Switch between supported languages in post/tag page
|
||||||
: getNextGlobalLangPath(currentPath) // Switch between all languages
|
: getNextGlobalLangPath(currentPath) // Switch between all languages in other pages
|
||||||
---
|
---
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -53,7 +53,7 @@ function setupScrollbar() {
|
||||||
}, {
|
}, {
|
||||||
scrollbars: {
|
scrollbars: {
|
||||||
theme: 'scrollbar-widget',
|
theme: 'scrollbar-widget',
|
||||||
autoHide: 'leave',
|
autoHide: 'never',
|
||||||
autoHideDelay: 500,
|
autoHideDelay: 500,
|
||||||
},
|
},
|
||||||
overflow: {
|
overflow: {
|
||||||
|
@ -89,17 +89,17 @@ document.addEventListener('astro:after-swap', setupScrollbar)
|
||||||
}
|
}
|
||||||
|
|
||||||
.scrollbar-widget {
|
.scrollbar-widget {
|
||||||
--os-size: 0.35rem;
|
--os-size: 0.6rem;
|
||||||
--os-padding-perpendicular: 0;
|
--os-padding-perpendicular: 0.1rem;
|
||||||
--os-padding-axis: 0;
|
--os-padding-axis: 0.2rem;
|
||||||
--os-handle-border-radius: 99rem;
|
--os-handle-border-radius: 99rem;
|
||||||
--os-handle-perpendicular-size: 75%;
|
--os-handle-perpendicular-size: 75%;
|
||||||
--os-handle-perpendicular-size-hover: 100%;
|
--os-handle-perpendicular-size-hover: 100%;
|
||||||
--os-handle-perpendicular-size-active: 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: 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-hover: oklch(var(--un-preset-theme-colors-secondary) / 0.30);
|
||||||
--os-handle-bg-active: oklch(var(--un-preset-theme-colors-secondary) / 0.25);
|
--os-handle-bg-active: oklch(var(--un-preset-theme-colors-secondary) / 0.30);
|
||||||
--os-handle-min-size: 12%;
|
--os-handle-min-size: 12%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ const filteredHeadings = headings.filter(heading =>
|
||||||
}
|
}
|
||||||
|
|
||||||
.accordion-content {
|
.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 */
|
/* 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> = {
|
export const walineLocaleMap: Record<string, string> = {
|
||||||
'zh': 'zh-CN',
|
'zh': 'zh-CN',
|
||||||
'zh-tw': 'zh-TW',
|
'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',
|
'en': 'en-US',
|
||||||
'es': 'es-ES',
|
'es': 'es-ES',
|
||||||
'ru': 'ru-RU',
|
'ru': 'ru-RU',
|
||||||
|
|
|
@ -23,7 +23,7 @@ const { isPost } = getPageInfo(Astro.url.pathname)
|
||||||
const fontStyle = themeConfig.global.fontStyle === 'serif' ? 'font-serif' : 'font-sans'
|
const fontStyle = themeConfig.global.fontStyle === 'serif' ? 'font-serif' : 'font-sans'
|
||||||
const MarginBottom = isPost && themeConfig.comment?.enabled
|
const MarginBottom = isPost && themeConfig.comment?.enabled
|
||||||
? 'mb-10' // Post page with comment system
|
? 'mb-10' // Post page with comment system
|
||||||
: 'mb-12' // Other pages
|
: 'mb-12' // Other pages without comment system
|
||||||
---
|
---
|
||||||
|
|
||||||
<html
|
<html
|
||||||
|
|
|
@ -27,11 +27,16 @@ export async function generateRSS({ lang }: GenerateRSSOptions = {}) {
|
||||||
(!data.draft && (data.lang === lang || data.lang === '' || (lang === undefined && data.lang === defaultLocale))),
|
(!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({
|
return rss({
|
||||||
title: siteTitle,
|
title: siteTitle,
|
||||||
site: lang ? `${url}/${lang}` : url,
|
site: lang ? `${url}/${lang}` : url,
|
||||||
description: siteDescription,
|
description: siteDescription,
|
||||||
stylesheet: '/rss/rss-style.min.xsl',
|
stylesheet: '/rss/rss-style.xsl',
|
||||||
customData: `
|
customData: `
|
||||||
<copyright>Copyright © ${new Date().getFullYear()} ${themeConfig.site.author}</copyright>
|
<copyright>Copyright © ${new Date().getFullYear()} ${themeConfig.site.author}</copyright>
|
||||||
<language>${lang || themeConfig.global.locale}</language>
|
<language>${lang || themeConfig.global.locale}</language>
|
||||||
|
@ -44,7 +49,7 @@ export async function generateRSS({ lang }: GenerateRSSOptions = {}) {
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
`.trim(),
|
`.trim(),
|
||||||
items: posts.map((post: CollectionEntry<'posts'>) => ({
|
items: sortedPosts.map((post: CollectionEntry<'posts'>) => ({
|
||||||
title: post.data.title,
|
title: post.data.title,
|
||||||
// Generate URL with language prefix and abbrlink/slug
|
// Generate URL with language prefix and abbrlink/slug
|
||||||
link: new URL(
|
link: new URL(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue