
Research
/Security News
Popular Go Decimal Library Targeted by Long-Running Typosquat with DNS Backdoor
A long-running Go typosquat impersonated the popular shopspring/decimal library and used DNS TXT records to execute commands.
astro-default-frontmatter
Advanced tools
A few plugins for defining default frontmatter for your markdown in Astro
This is a simple collection of remark plugins for Astro that allows you to define a default frontmatter for you markdown files
Plugins:
defaultLayout define a default layout for ALL markdowndefaultFrontmatter define a default frontmatter for ALL markdowndefaultFrontmatterAdvanced define a default frontmatter based on the files directory in the projectIf you want to see how these plugins work you can check out the Stackblitz Demo
defaultLayoutOption/Argument Type: string
Define a default layout for ALL markdown in your project
Example//astro.config.mjs
import { defineConfig } from 'astro/config';
import { defaultLayout } from 'astro-default-frontmatter';
export default defineConfig({
markdown: {
remarkPlugins: [
[defaultLayout, "~/layouts/DefaultLayout.astro"]
]
}
});
defaultFrontmatterOption/Argument Type: Record<string, any>
Define a default frontmatter for ALL markdown in your project
Example//astro.config.mjs
import { defineConfig } from 'astro/config';
import { defaultFrontmatter } from 'astro-default-frontmatter';
export default defineConfig({
markdown: {
remarkPlugins: [
[defaultFrontmatter, {
layout: "~/layouts/DefaultLayout.astro",
title: 'Default Title'
}]
]
}
});
defaultFrontmatterAdvancedOption/Argument Type:
Array<{
dirs: string[];
frontmatter: Record<string, unknown>;
replace?: boolean;
}>
Define a default frontmatter based on what directory the file is in
Options should be in order from less specific dirs --> more specific dirs to stop frontmatters from overlapping './' -> './src' -> './src/content' -> './src/content/1.md'
dirsType: Array<string>
A list of directories that frontmatter will be applied to
frontmatterType: Record<string, any>
Frontmatter object that will be applied to all directories in dirs
replaceType: boolean
Replace the frontmatter entirely instead of spreading new values ontop of old values
Or
//astro.config.mjs
import { defineConfig } from 'astro/config';
import { defaultFrontmatterAdvanced } from 'astro-default-frontmatter';
const Options = [
{
dirs: ['./'],
frontmatter: { layout: "~/layouts/DefaultLayout.astro" },
},
{
dirs: ['./src/content'],
frontmatter: { layout: "~/layouts/DirectoryLayout.astro" },
},
{
dirs: ['./src/content/2.md'],
frontmatter: { layout: "~/layouts/FileLayout.astro" }
},
{
dirs: ['./src/content/5.md'],
frontmatter: {},
replace: true
}
]
export default defineConfig({
markdown: {
remarkPlugins: [
[defaultFrontmatterAdvanced, Options]
],
},
});
Output:
1.md -> {
"layout": "../layouts/FrontmatterLayout.astro",
"title": "Title From File"
}
2.md -> {
"layout": "../layouts/FileLayout.astro"
}
3.md -> {
"layout": "../layouts/DirectoryLayout.astro"
}
4.md -> {
"layout": "../layouts/DirectoryLayout.astro"
}
5.md -> {}
FAQs
A few plugins for defining default frontmatter for your markdown in Astro
The npm package astro-default-frontmatter receives a total of 5 weekly downloads. As such, astro-default-frontmatter popularity was classified as not popular.
We found that astro-default-frontmatter 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.

Research
/Security News
A long-running Go typosquat impersonated the popular shopspring/decimal library and used DNS TXT records to execute commands.

Research
Active npm supply chain attack compromises @antv packages in a fast-moving malicious publish wave tied to Mini Shai-Hulud.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.