Skip to content

Commit

Permalink
fix: json-ld format
Browse files Browse the repository at this point in the history
  • Loading branch information
fbuireu committed Sep 29, 2024
1 parent f7bf445 commit 8d53ff3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Testimonials from "@modules/home/components/testimonials/Testimonials.ast
import Welcome from "@modules/home/components/welcome/Welcome.astro";
// table of contents (details on mobile)
// check jsonLD (https://jsonld.com/social-network-profiles/)
// check responsive
// todo: add signature email
// todo: add small transitions & animations
Expand Down
37 changes: 20 additions & 17 deletions src/ui/modules/core/components/breadcrumbs/Breadcrumbs.astro
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
import { breadcrumbDTO } from "@application/dto/breadcrumb/breadcrumbDTO";
import { getLocation } from "@modules/core/utils/getLocation";
import "./breadcrumbs.css";
const { pathname: currentPath, origin: originPath } = Astro.url;
const breadcrumbs = breadcrumbDTO.create({ currentPath });
const location = getLocation(Astro.url);
import { breadcrumbDTO } from "@application/dto/breadcrumb/breadcrumbDTO";
import { getLocation } from "@modules/core/utils/getLocation";
import "./breadcrumbs.css";
const { pathname: currentPath, origin: originPath } = Astro.url;
const breadcrumbs = breadcrumbDTO.create({ currentPath });
const location = getLocation(Astro.url);
---
<section class:list={[`breadcrumbs__wrapper common-wrapper`, { [`--is-${location}`]: location}]}>
<ul class="breadcrumbs__list flex justify-center align-center font-sans-serif">
Expand All @@ -20,17 +20,20 @@ const location = getLocation(Astro.url);
) : (
<strong class="--is-current-page">{label}</strong>
)}
<script is:inline type="application/ld+json" set:html={JSON.stringify({
"@context": "https://schema.org",
"@type": "ListItem",
"position": index + 1,
"item": {
"@id": `${originPath}${link}`,
"name": label
}
})}/>
</li>
);
})}
<script is:inline type="application/ld+json" set:html={JSON.stringify({
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": breadcrumbs.map(({ link, label }, index) => ({
"@type": "ListItem",
"position": index + 1,
"item": {
"@id": `${originPath}${link}`,
"name": label
}
}))
})}/>
</ul>
</section>

0 comments on commit 8d53ff3

Please sign in to comment.