feat: added microdata to article post

This commit is contained in:
Sergey Yarkov 2022-08-17 21:16:38 +03:00
parent 2f11e6020b
commit 2550e807d3
2 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
--- ---
import './ArticleContent.scss'; import "./ArticleContent.scss";
--- ---
<div class='article-content '><slot></slot></div> <div itemprop="articleBody" class="article-content"><slot /></div>

View File

@ -14,31 +14,31 @@ const { data, lang } = Astro.props as Props;
const { title, tags, author, published_at } = data; const { title, tags, author, published_at } = data;
--- ---
<article class="article"> <article itemscope itemtype="http://schema.org/BlogPosting" class="article">
<header> <header>
<div class="tags"> <div class="tags">
<ul> <ul itemprop="keywords">
{ {
tags.map((tag) => ( tags.map((tag) => (
<li> <li>
<TranslatedLink to={`/articles/?tags=${tag.toLocaleLowerCase()}`}>{`${tag}${tags.at(-1) === tag ? "" : ","}`}</TranslatedLink> <TranslatedLink rel="tag" to={`/articles/?tags=${tag.toLocaleLowerCase()}`}>{`${tag}${tags.at(-1) === tag ? "" : ","}`}</TranslatedLink>
</li> </li>
)) ))
} }
</ul> </ul>
</div> </div>
<div class="heading"> <div class="heading">
<h1>{title}</h1> <h1 itemprop="headline">{title}</h1>
</div> </div>
<div class="published"> <div class="published">
<time datetime={published_at}>{createDateFormatter(lang).format(new Date(published_at))}</time> <time itemprop="datePublished" datetime={published_at}>{createDateFormatter(lang).format(new Date(published_at))}</time>
<span>{author}</span> <span itemprop="author">{author}</span>
</div> </div>
{ {
data.coverImage && ( data.coverImage && (
<div> <div>
<figure> <figure>
<Image src={data.coverImage} width={700} height={400} aspectRatio={"16:9"} format={"webp"} alt={data.title} /> <Image itemprop="image" src={data.coverImage} width={700} height={400} aspectRatio={"16:9"} format={"webp"} alt={data.title} />
</figure> </figure>
</div> </div>
) )