image :)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Michael Zhang 2024-09-18 06:54:28 -05:00
parent 79e8a2300a
commit 3e4f2d0095
2 changed files with 13 additions and 12 deletions

View file

@ -4,6 +4,7 @@ import LeftNav from "../components/LeftNav.astro";
import classNames from "classnames";
import "../styles/global.scss";
import "katex/dist/katex.min.css";
import portrait from "../assets/self.png";
interface Props {
title?: string;
@ -21,6 +22,7 @@ const hasToc = toc ?? false;
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:image" content={portrait.src} />
<title>{title && `${title} - `} Michael Zhang</title>
<script
data-goatcounter="https://goatcounter.mzhang.io/count"

View file

@ -7,7 +7,6 @@ import Timestamp from "../../components/Timestamp.astro";
import { getImage } from "astro:assets";
import TocWrapper from "../../components/TocWrapper.astro";
import TagList from "../../components/TagList.astro";
import portrait from "../../assets/self.png";
export async function getStaticPaths() {
const posts = await getCollection("posts");
@ -21,7 +20,7 @@ type Props = CollectionEntry<"posts">;
const post = Astro.props;
const { Content, remarkPluginFrontmatter, headings } = await post.render();
const { title, toc, heroImage: heroImagePath, heroAlt, draft } = post.data;
const { title, toc, heroImage: heroImagePath, heroAlt } = post.data;
let heroImage = undefined;
if (heroImagePath) {
@ -41,16 +40,16 @@ const excerpt = remarkPluginFrontmatter.excerpt?.replaceAll("\n", "");
<meta slot="head" property="og:description" content={excerpt} />
<meta slot="head" property="og:type" content="article" />
<meta slot="head" property="og:locale" content="en_US" />
{heroImage ?
<>
<meta slot="head" property="og:image" content={heroImage.src} />
{heroAlt && <meta slot="head" property="og:image:alt" content={heroAlt} />}
</>
:
<>
<meta slot="head" property="og:image" content={portrait.src} />
</>
}
<!-- {
heroImage ? (
<>
<meta slot="head" property="og:image" content={heroImage.src} />
{heroAlt && <meta slot="head" property="og:image:alt" content={heroAlt} />}
</>
) : (
<></>
)
} -->
<meta slot="head" property="keywords" content={post.data.tags.join(", ")} />
<meta slot="head" property="description" content={excerpt} />