This commit is contained in:
parent
79e8a2300a
commit
3e4f2d0095
2 changed files with 13 additions and 12 deletions
|
@ -4,6 +4,7 @@ import LeftNav from "../components/LeftNav.astro";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import "../styles/global.scss";
|
import "../styles/global.scss";
|
||||||
import "katex/dist/katex.min.css";
|
import "katex/dist/katex.min.css";
|
||||||
|
import portrait from "../assets/self.png";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
|
@ -21,6 +22,7 @@ const hasToc = toc ?? false;
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta property="og:image" content={portrait.src} />
|
||||||
<title>{title && `${title} - `} Michael Zhang</title>
|
<title>{title && `${title} - `} Michael Zhang</title>
|
||||||
<script
|
<script
|
||||||
data-goatcounter="https://goatcounter.mzhang.io/count"
|
data-goatcounter="https://goatcounter.mzhang.io/count"
|
||||||
|
|
|
@ -7,7 +7,6 @@ import Timestamp from "../../components/Timestamp.astro";
|
||||||
import { getImage } from "astro:assets";
|
import { getImage } from "astro:assets";
|
||||||
import TocWrapper from "../../components/TocWrapper.astro";
|
import TocWrapper from "../../components/TocWrapper.astro";
|
||||||
import TagList from "../../components/TagList.astro";
|
import TagList from "../../components/TagList.astro";
|
||||||
import portrait from "../../assets/self.png";
|
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await getCollection("posts");
|
const posts = await getCollection("posts");
|
||||||
|
@ -21,7 +20,7 @@ type Props = CollectionEntry<"posts">;
|
||||||
|
|
||||||
const post = Astro.props;
|
const post = Astro.props;
|
||||||
const { Content, remarkPluginFrontmatter, headings } = await post.render();
|
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;
|
let heroImage = undefined;
|
||||||
if (heroImagePath) {
|
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:description" content={excerpt} />
|
||||||
<meta slot="head" property="og:type" content="article" />
|
<meta slot="head" property="og:type" content="article" />
|
||||||
<meta slot="head" property="og:locale" content="en_US" />
|
<meta slot="head" property="og:locale" content="en_US" />
|
||||||
{heroImage ?
|
<!-- {
|
||||||
|
heroImage ? (
|
||||||
<>
|
<>
|
||||||
<meta slot="head" property="og:image" content={heroImage.src} />
|
<meta slot="head" property="og:image" content={heroImage.src} />
|
||||||
{heroAlt && <meta slot="head" property="og:image:alt" content={heroAlt} />}
|
{heroAlt && <meta slot="head" property="og:image:alt" content={heroAlt} />}
|
||||||
</>
|
</>
|
||||||
:
|
) : (
|
||||||
<>
|
<></>
|
||||||
<meta slot="head" property="og:image" content={portrait.src} />
|
)
|
||||||
</>
|
} -->
|
||||||
}
|
|
||||||
|
|
||||||
<meta slot="head" property="keywords" content={post.data.tags.join(", ")} />
|
<meta slot="head" property="keywords" content={post.data.tags.join(", ")} />
|
||||||
<meta slot="head" property="description" content={excerpt} />
|
<meta slot="head" property="description" content={excerpt} />
|
||||||
|
|
Loading…
Reference in a new issue