Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/components/overrides/TableOfContents.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,32 @@ import Default from "@astrojs/starlight/components/TableOfContents.astro";

import { Icon } from "@astrojs/starlight/components";
import FeedbackPrompt from "../FeedbackPrompt.tsx";

const tags = Astro.locals.starlightRoute.entry.data.tags;
---

<Default />
{
tags && (
<>
<br />
<div>
<h2>Tags</h2>
<div class="flex gap-2">
{tags.map((tag) => (
<a
href={`/search/?tags=${tag}`}
class="rounded-sm border border-(--sl-color-hairline) px-3 text-black"
data-tag-serp-link={true}
>
{tag}
</a>
))}
</div>
</div>
</>
)
}
<br />
<FeedbackPrompt client:idle />
{
Expand Down
8 changes: 8 additions & 0 deletions src/scripts/analytics/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export function registerLinks() {
for (const el of elements) {
const { hostname, pathname } = new URL(el.href);

if (el.dataset.tagSerpLink) {
el.addEventListener("click", () => {
track("click docs tag", { value: el.innerText });
});

continue;
}

if (hostname === "developers.cloudflare.com" || hostname === "localhost") {
continue;
}
Expand Down
Loading