mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 19:41:02 +08:00
refactor: enable scroll-smooth only in post detail page
This commit is contained in:
@@ -13,6 +13,7 @@ export interface Props {
|
||||
canonicalURL?: string;
|
||||
pubDatetime?: Date;
|
||||
modDatetime?: Date;
|
||||
scrollSmooth?: boolean;
|
||||
}
|
||||
|
||||
const {
|
||||
@@ -23,6 +24,7 @@ const {
|
||||
canonicalURL = new URL(Astro.url.pathname, Astro.site).href,
|
||||
pubDatetime,
|
||||
modDatetime,
|
||||
scrollSmooth = false,
|
||||
} = Astro.props;
|
||||
|
||||
const socialImageURL = new URL(
|
||||
@@ -32,7 +34,10 @@ const socialImageURL = new URL(
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang=`${LOCALE.lang ?? "en"}`>
|
||||
<html
|
||||
lang=`${LOCALE.lang ?? "en"}`
|
||||
class={`${scrollSmooth && "scroll-smooth"}`}
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
|
||||
@@ -40,6 +40,7 @@ const layoutProps = {
|
||||
modDatetime,
|
||||
canonicalURL,
|
||||
ogImage: ogUrl,
|
||||
scrollSmooth: true,
|
||||
};
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user