mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-29 07:53:27 -04:00
[pl][blog] expose relevant posts on /neutratywy and /osobatywy
This commit is contained in:
parent
f3e52940bc
commit
7037379c8b
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="columnist-wall row">
|
<div class="columnist-wall row">
|
||||||
<div v-for="post in posts" class="columnist-column col-12 col-sm-6 col-md-4 mb-3">
|
<div v-for="post in postsFull" class="columnist-column col-12 col-sm-6 col-md-4 mb-3">
|
||||||
<div class="card shadow">
|
<div class="card shadow">
|
||||||
<nuxt-link v-if="post.hero" :to="generateLink(post.slug)" class="">
|
<nuxt-link v-if="post.hero" :to="generateLink(post.slug)" class="">
|
||||||
<img :src="post.hero" class="w-100"/>
|
<img :src="post.hero" class="w-100"/>
|
||||||
@ -47,15 +47,35 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { shortcuts };
|
return {
|
||||||
|
shortcuts,
|
||||||
|
postsFull: [],
|
||||||
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
async mounted() {
|
||||||
|
this.postsFull = await this.loadFullPosts(this.posts);
|
||||||
|
|
||||||
|
console.log(this.postsFull);
|
||||||
|
|
||||||
if (!process.client) { return; }
|
if (!process.client) { return; }
|
||||||
|
|
||||||
const columnist = new Columnist(this.$el);
|
const columnist = new Columnist(this.$el);
|
||||||
columnist.start();
|
columnist.start();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async loadFullPosts(posts) {
|
||||||
|
if (!posts.length) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (typeof(posts[0]) === 'object') {
|
||||||
|
return posts;
|
||||||
|
}
|
||||||
|
return await this.$axios.$get(`/blog`, {
|
||||||
|
params: {
|
||||||
|
slugs: posts,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
generateLink(slug) {
|
generateLink(slug) {
|
||||||
return this.shortcuts[slug] !== undefined
|
return this.shortcuts[slug] !== undefined
|
||||||
? `/${this.shortcuts[slug]}`
|
? `/${this.shortcuts[slug]}`
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
</figure>
|
</figure>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<BlogEntriesList :posts="['etymologia-odmiana-neutratywów', 'neutratywy-zdrobnienia']"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
<details class="border mb-3">
|
<details class="border mb-3">
|
||||||
<summary class="bg-light p-3">
|
<summary class="bg-light p-3">
|
||||||
<h4 class="h5 d-inline"><T>nouns.neuterNouns.extended.header</T></h4>
|
<h4 class="h5 d-inline"><T>nouns.neuterNouns.extended.header</T></h4>
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
<p><Share :title="$t('nouns.personNouns.header')"/></p>
|
<p><Share :title="$t('nouns.personNouns.header')"/></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<BlogEntriesList :posts="['krótka-notka-o-osobatywach', 'osobatywy-nie-takie-straszne']"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
<details open class="border mb-3">
|
<details open class="border mb-3">
|
||||||
<summary class="bg-light p-3">
|
<summary class="bg-light p-3">
|
||||||
<h4 class="h5 d-inline"><T>nouns.examples</T></h4>
|
<h4 class="h5 d-inline"><T>nouns.examples</T></h4>
|
||||||
|
@ -66,18 +66,26 @@ router.get('/blog', handleErrorAsync(async (req, res) => {
|
|||||||
return posts;
|
return posts;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return res.json(posts.filter(post => {
|
||||||
if (req.query.shortcuts !== undefined) {
|
if (req.query.shortcuts !== undefined) {
|
||||||
const postsShortcuts = [];
|
if (!global.config.blog || !global.config.blog.shortcuts) {
|
||||||
if (global.config.blog && global.config.blog.shortcuts) {
|
return false;
|
||||||
for (let slug of Object.values(global.config.blog.shortcuts)) {
|
}
|
||||||
postsShortcuts.push(posts.filter(p => p.slug === slug)[0])
|
|
||||||
|
if (!Object.values(global.config.blog.shortcuts).includes(post.slug)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.json(postsShortcuts);
|
if (req.query.slugs !== undefined) {
|
||||||
|
const slugs = Array.isArray(req.query.slugs) ? req.query.slugs : [req.query.slugs];
|
||||||
|
if (!slugs.includes(post.slug)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.json(posts);
|
return true;
|
||||||
|
}));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user