Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.