Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
saber-plugin-query-posts
Advanced tools
Query posts and inject them to specific pages. Useful when you're writing a blog.
Query posts and inject them to specific pages. Useful when you're writing a blog.
yarn add saber-plugin-query-posts
In your saber-config.yml
:
plugins:
- resolve: saber-plugin-query-posts
Then this plugin will inject all posts to pages whose attribute injectAllPosts
is set to true
, for instance you can create a pages/index.md
:
---
layout: index
injectAllPosts: true
---
Welcome to my homepage.
Then in the layout component layouts/index.vue
, page.posts
and page.pagination
will be available:
<template>
<div>
<slot name="default" />
<ul>
<li v-for="post in page.posts" :key="post.permalink">
<a :href="post.permalink">
{{ post.title }}
</a>
</li>
</ul>
<a :href="page.pagination.prevLink" v-if="page.pagination.hasPrev">
← Prev Page
</a>
<a :href="page.pagination.nextLink" v-if="page.pagination.hasNext">
Next Page →
</a>
</div>
</template>
<script>
export default {
props: ['page']
}
</script>
Posts with front matter draft: true
will be excluded in page.posts
, but they will still be built and accessible via permalink.
This plugin will automatically generate tag pages at /tags/:tag
when you're using tags
in page data, e.g. in a Markdown post:
---
title: hello
date: 2019-01-01
tags:
- life
- random
---
hello
You can access the detailed info of the tags of a post page via this.page.tagsInfo
, for instance:
tags:
- life
- random
gives you:
;[
{
name: 'life',
permalink: '/tags/life'
},
{
name: 'random',
permalink: '/tags/random'
}
]
Tag pages will use the tag
layout or fallback to default
layout.
You can access the tag name in the layout component via this.page.tag
.
This plugin will automatically generate category pages at /categories/:tag
when you're using categories
in page data, e.g. in a Markdown post:
---
title: hello
date: 2019-01-01
categories:
- sports
---
hello
Then there will be a /categories/sports
page,categories
is an array, so you can assign the post to multiple categories.
You can access the detailed info of the categories of a post page via this.page.categoriesInfo
, for instance:
categories:
- sports/football
- hobby
gives you:
;[
{
name: 'sports',
permalink: '/categories/sports'
},
{
name: 'football',
permalink: '/categories/sports/football'
},
{
name: 'hobby',
permalink: '/categories/hobby'
}
]
It also support nesting categories:
categories:
- sports/football
In this way, it will generate two pages: /categories/sports
and /categories/sports/football
and both of them will include this post.
Category pages will use the category
layout or fallback to default
layout.
You can access the category name in the layout component via this.page.category
.
By default we show at most 30 posts per page, but you can configure this globally using perPage
option in saber-config.yml
:
plugins:
- resolve: saber-plugin-query-posts
options:
perPage: 6
It's also possible to configure this behavior for each page separately, in a page like pages/index.md
:
---
injectAllPosts:
perPage: 20
---
number
30
The limit of posts to show per page.
boolean
false
Only generate the first page of posts.
{ [name: string]: string }
Map tag name to permalink's :tag
part, by default :tag
will be the tag name.
For example:
{
tagsMap: {
'c++': 'cpp'
}
}
Same as tagsMap
but for categories.
{ category?: string, tag?: string }
{ category: '/categories/:slug', tag: '/tags/:slug' }
The permalink templates for category and tag pages, available placeholders:
placeholder | description |
---|---|
slug | Slugified tag / category name. |
MIT.
FAQs
Query posts and inject them to specific pages. Useful when you're writing a blog.
We found that saber-plugin-query-posts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.