Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Seamain/Blog-New
Browse files Browse the repository at this point in the history
  • Loading branch information
Seamain committed Sep 22, 2024
2 parents e8f697a + e0eacc4 commit a4dc51b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/layouts/BasicStyle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ interface Props {
ml?: string;
title?: string;
ogImage?: string;
author?: string;
canonicalURL?: string;
publishedTime?: Date;
}
const {
description,
ml,
ogImage,
author,
title,
publishedTime,
canonicalURL = new URL(Astro.url.pathname, Astro.site).href,
} = Astro.props;
Expand All @@ -28,6 +32,11 @@ const socialImageURL = new URL(ogImage ?? "og.png", Astro.url.origin).href;
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<meta name="description" content={description} />
<meta name="author" content={author} />
<meta
property="article:published_time"
content={publishedTime?.toISOString()}
/>

<!-- Open Graph/Facebook -->
<meta property="og:title" content={title} />
Expand All @@ -37,10 +46,10 @@ const socialImageURL = new URL(ogImage ?? "og.png", Astro.url.origin).href;
<meta property="og:logo" content="/favicon.svg" />

<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content={canonicalURL} />
<meta name="twitter:title" content={title} />
<meta name="twitter:image" content={socialImageURL} />
<meta property="twitter:title" content={title} />
<meta property="twitter:image" content={socialImageURL} />
<title>Seamain's Blog</title>
</head>
<body class={ml + " overflow-x-hidden font-mono"}>
Expand Down
3 changes: 3 additions & 0 deletions src/pages/posts/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const formatedTime = formatDate(new Date(post.createdAt), "yyyy-MM-dd");
let html = Markdown().render(post.content);
const customCss =
"\n<style>p {padding-bottom: 1rem; font-size: 1.125rem; line-height: 1.75rem; } \nh2{font-size: 1.5rem; line-height: 2rem; font-weight: 700 }</style>";
const publishedTime = new Date(Date.parse(post.createdAt));
html = html.concat(customCss);
---
Expand All @@ -61,6 +62,8 @@ html = html.concat(customCss);
description={post.summary}
ml="flex flex-col items-center"
ogImage={"/posts/" + post.slug + ".png"}
author={post.author.data?.attributes.name}
publishedTime={publishedTime}
>
<div class="flex flex-col items-center">
<Navbar />
Expand Down

0 comments on commit a4dc51b

Please sign in to comment.