mirror of
https://github.com/Ocelot-Social-Community/ocelot.social.git
synced 2025-12-12 23:35:59 +00:00
Move HTML template part before script part
This commit is contained in:
parent
ef889d701c
commit
71c9485abf
@ -1,31 +1,3 @@
|
|||||||
<script setup>
|
|
||||||
import { computed } from "vue";
|
|
||||||
import { useRouteLocale } from "vuepress/client";
|
|
||||||
import articles from "@temp/mini-blog.articles.json"; // kommt aus dem Build-Hook
|
|
||||||
|
|
||||||
const locale = useRouteLocale();
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
title: { type: String},
|
|
||||||
readMoreLinkTitle: { type: String},
|
|
||||||
showAllPostsButtonTitle: { type: String},
|
|
||||||
});
|
|
||||||
|
|
||||||
// Nur Artikel des aktuellen Locales + Top 3
|
|
||||||
const items = computed(() => {
|
|
||||||
const loc = locale.value || "/";
|
|
||||||
const list = (articles || []).filter(a => a.locale === loc);
|
|
||||||
return list.slice(0, 3);
|
|
||||||
});
|
|
||||||
|
|
||||||
const articleIndex = computed(() =>
|
|
||||||
(locale.value === "/" ? "/article/" : `${locale.value}article/`)
|
|
||||||
);
|
|
||||||
|
|
||||||
const formatDate = (d) =>
|
|
||||||
d ? new Date(d).toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric" }) : "";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="mini-blog__div" v-if="items.length">
|
<div class="mini-blog__div" v-if="items.length">
|
||||||
<h2 class="large-header">{{ title }}</h2>
|
<h2 class="large-header">{{ title }}</h2>
|
||||||
@ -75,6 +47,34 @@ const formatDate = (d) =>
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { computed } from "vue";
|
||||||
|
import { useRouteLocale } from "vuepress/client";
|
||||||
|
import articles from "@temp/mini-blog.articles.json"; // kommt aus dem Build-Hook
|
||||||
|
|
||||||
|
const locale = useRouteLocale();
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
title: { type: String},
|
||||||
|
readMoreLinkTitle: { type: String},
|
||||||
|
showAllPostsButtonTitle: { type: String},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Nur Artikel des aktuellen Locales + Top 3
|
||||||
|
const items = computed(() => {
|
||||||
|
const loc = locale.value || "/";
|
||||||
|
const list = (articles || []).filter(a => a.locale === loc);
|
||||||
|
return list.slice(0, 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
const articleIndex = computed(() =>
|
||||||
|
(locale.value === "/" ? "/article/" : `${locale.value}article/`)
|
||||||
|
);
|
||||||
|
|
||||||
|
const formatDate = (d) =>
|
||||||
|
d ? new Date(d).toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric" }) : "";
|
||||||
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* Abschnitt */
|
/* Abschnitt */
|
||||||
.mini-blog {
|
.mini-blog {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user