[+] Pin posts

This commit is contained in:
Hykilpikonna
2021-12-26 21:56:54 -05:00
parent 1fb5885afe
commit fb60d850b8
+6 -1
View File
@@ -35,8 +35,13 @@ export default class Blog extends Vue
get filteredPosts(): BlogPost[] 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)) 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> </script>