summaryrefslogtreecommitdiff
path: root/src/components/templates
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-07-06 22:27:04 -0300
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-07-06 22:27:04 -0300
commit449f71511e539878af4c65f073cdc373b469c45e (patch)
tree6c264a77426284d97d1c9b9d7a27a6015c3077a8 /src/components/templates
parent4ae2b810b68538ba4c287b0c80d6c2e002fe9ddd (diff)
feat: more structured data
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/components/templates')
-rw-r--r--src/components/templates/MicroBlog.astro27
-rw-r--r--src/components/templates/Search.astro15
-rw-r--r--src/components/templates/SimplePostList.astro33
3 files changed, 52 insertions, 23 deletions
diff --git a/src/components/templates/MicroBlog.astro b/src/components/templates/MicroBlog.astro
index c16155e..88321dc 100644
--- a/src/components/templates/MicroBlog.astro
+++ b/src/components/templates/MicroBlog.astro
@@ -2,12 +2,9 @@
import Date from "@components/organisms/Date.astro";
import KeywordsList from "@components/organisms/KeywordsList.astro";
import { getFirstUserID, getLastUpdate } from "@lib/collection/helpers";
-import { Micro } from "@lib/collection/schemas";
-import type { CollectionEntry, z } from "astro:content";
+import type { Micro, MicroEntry } from "@lib/collection/schemas";
-interface Props extends CollectionEntry<"blog"> {
- data: z.infer<typeof Micro>;
-}
+interface Props extends MicroEntry {}
const micro = Astro.props;
const { id, data, rendered } = micro;
@@ -19,10 +16,14 @@ const [first, ...names] = display.split(/\s/);
const last = names.length > 0 ? names[names.length - 1] : "";
const little = ((first?.[0] ?? "") + (last?.[0] ?? "")).slice(0, 2);
---
-<article>
+<article
+ itemprop="blogPost"
+ itemscope
+ itemtype="https://schema.org/BlogPosting"
+>
<header>
<h3 class="title">
- <a href={`/blog/read/${id}`}>{title}</a>
+ <a href={`/blog/read/${id}`} itemprop="headline name">{title}</a>
</h3>
<span class="profile_picture">{
user?.website ? <a href={user.website}>{little}</a> : (
@@ -30,15 +31,21 @@ const little = ((first?.[0] ?? "") + (last?.[0] ?? "")).slice(0, 2);
)
}</span>
<div>
- {first} {last} <small>· <Date
+ <span
+ itemprop="author"
+ itemscope
+ itemtype="https://schema.org/Person"
+ ><span itemprop="alternateName">{first} {last}</span></span>
+ <span class="small">· <Date
{date}
locales={lang}
options={{ month: "short", day: "numeric" }}
- /></small>
+ itemprop="dateModified"
+ /></span>
</div>
</header>
<div class="content small">
- <div {lang}>
+ <div {lang} itemprop="articleBody text">
<Fragment set:html={rendered?.html} />
</div>
<footer>
diff --git a/src/components/templates/Search.astro b/src/components/templates/Search.astro
index 5245643..ae80d32 100644
--- a/src/components/templates/Search.astro
+++ b/src/components/templates/Search.astro
@@ -2,8 +2,16 @@
const { site } = Astro;
---
-<search>
- <link rel="dns-prefetch" href="https://www.google.com/search">
+<search
+ itemprop="potentialAction"
+ itemscope
+ itemtype="https://schema.org/SearchAction"
+>
+ <link
+ rel="dns-prefetch"
+ href="https://www.google.com/search"
+ itemprop="target"
+ >
<form
action="https://www.google.com/search"
target="_blank"
@@ -13,7 +21,7 @@ const { site } = Astro;
name="search"
>
<details>
- <summary>Pesquisar no website</summary>
+ <summary itemprop="description">Pesquisar no website</summary>
<div class="details">
<p>
<label>Barra de pesquisa <input
@@ -25,6 +33,7 @@ const { site } = Astro;
title={`"site:${site} " é usado para que os resultados da pesquisa fiquem restritos a este website`}
pattern={`site:${site} .+`}
size={`site:${site} .+`.length}
+ itemprop="query"
/></label>
</p>
<p class="mute">
diff --git a/src/components/templates/SimplePostList.astro b/src/components/templates/SimplePostList.astro
index c2c002b..164b32b 100644
--- a/src/components/templates/SimplePostList.astro
+++ b/src/components/templates/SimplePostList.astro
@@ -21,14 +21,22 @@ const { posts } = Astro.props;
const display = name ?? email ?? entity;
return (
<li>
- <article>
- <h3><a href={`/blog/read/${id}`}>{title}</a></h3>
- {
- description &&
- description.split("\n\n").map((paragraph) => (
- <p class="small">{paragraph}</p>
- ))
- }
+ <article
+ itemprop="blogPost"
+ itemscope
+ itemtype="https://schema.org/BlogPosting"
+ >
+ <h3>
+ <a href={`/blog/read/${id}`} itemprop="headline name">{title}</a>
+ </h3>
+ <div itemprop="abstract">
+ {
+ description &&
+ description.split("\n\n").map((paragraph) => (
+ <p class="small">{paragraph}</p>
+ ))
+ }
+ </div>
<footer class="small">
<Date
@@ -39,7 +47,12 @@ const { posts } = Astro.props;
month: "long",
day: "numeric",
}}
- />{display}
+ itemprop="dateModified"
+ /><span
+ itemprop="author"
+ itemscope
+ itemtype="https://schema.org/Person"
+ ><span itemprop="alternateName">{display}</span></span>
<KeywordsList {keywords} />
</footer>
</article>
@@ -58,7 +71,7 @@ const { posts } = Astro.props;
& > article {
padding-inline-end: calc(var(--size-9) * 1em);
- & > p:not(:first-of-type) {
+ & > [itemprop="abstract"] > p:not(:first-of-type) {
margin-block-start: 1.5em;
}