[+] Pin posts
This commit is contained in:
+6
-1
@@ -35,8 +35,13 @@ export default class Blog extends Vue
|
||||
|
||||
get filteredPosts(): BlogPost[]
|
||||
{
|
||||
return this.meta.posts.filter(it => it.pinned || (this.tag ? it.tags.includes(this.tag) :
|
||||
const posts = this.meta.posts.filter(it => !it.pinned || (this.tag ? it.tags.includes(this.tag) :
|
||||
this.category ? it.category == this.category : true))
|
||||
|
||||
// Put pinned posts on top
|
||||
posts.sort((a, b) => (b.pinned ?? 0) - (a.pinned ?? 0))
|
||||
|
||||
return posts
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user