diff --git a/src/views/Blog.vue b/src/views/Blog.vue index 82cbb0a..bcdd7a8 100644 --- a/src/views/Blog.vue +++ b/src/views/Blog.vue @@ -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 } }