Optimize WarGear Links

This commit is contained in:
2024-02-16 23:48:52 +01:00
parent d15e37d6a1
commit 4ed5ed3e35
7 changed files with 469 additions and 76 deletions

View File

@@ -7,6 +7,8 @@ import LanguageWarning from "@components/LanguageWarning.astro";
export const getStaticPaths = createGetStaticPaths(async () => {
let posts = await getCollection("rules", value => value.id.split("/")[0] === astroI18n.locale);
console.log(posts);
const germanPosts = await getCollection("rules", entry => entry.id.split("/")[0] === "de");
germanPosts.forEach(value => {
@@ -38,21 +40,6 @@ const {Content} = await page.render();
)}
<Content/>
</article>
<script>
import {l} from "../../util/util";
class LinkTo extends HTMLElement {
private connectedCallback() {
const text = this.innerHTML;
const href = l("/rules/" + this.dataset["to"]);
this.innerHTML = `<a href="${href}">${text}</a>`;
}
}
customElements.define("link-to", LinkTo);
</script>
</PageLayout>
<style is:global>