blob: 8830af3b84e1ef67acd6d70ad389ad087866f561 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
---
import { getCollection } from "astro:content";
import Base from "@layouts/Base.astro";
import KeywordsList from "@components/organisms/KeywordsList.astro";
const title = "Palavras-Chave";
const description = "Palavras-Chave";
const blogs = await getCollection("blog");
const map: Map<string, number> = new Map();
for (const { data } of blogs) {
if (!("keywords" in data)) {
continue;
}
for (const k of data.keywords) {
const n = map.get(k) ?? 0;
map.set(k, n + 1);
}
}
let keywords = Array.from(map.entries()).sort(([, a], [, b]) => b - a).map((
[x],
) => x);
---
<Base {title} {description} {keywords}>
<main
itemprop="mainContentOfPage"
itemscope
itemtype="https://schema.org/WebPageElement"
>
<h2 itemprop="name description">Palavras-Chave</h2>
<div>
<KeywordsList {keywords} />
</div>
</main>
</Base>
<style>
div {
display: flex;
margin-inline: auto;
}
</style>
|