-
Hello all, I'm new to this. So I'm setting up a blog using sveltekit and mdsvex, which internally uses remark. {
"default": {},
"metadata": {
"title": "Getting Started",
"date": "9/9/2021",
"readingTime": {
"text": "3 min read",
"minutes": 2.295,
"time": 137700,
"words": 459
},
"preview": "Thanks for checking out my blog template. It’s based on the blog I built for my own website and I hope this is a good starting point for you to start yours.",
"previewHtml": "<p>Thanks for checking out my blog template. It’s based on the blog I built for my own <a href=\"https://mattjennings.io\" rel=\"nofollow\">website</a> and I hope this is a good starting point for you to start yours.</p>",
"slug": "getting-started"
}
} As I said, I'm using sveltekit, in a SSR setup. If I try just to get the file name Module "fs" has been externalized for browser compatibility and cannot be accessed in client code. If someone wants to dig into, I'm running a setup similar to this: It would be useful to have the .md file's stat in metadata {} so that I could use stat.mdate | stat.mdate as defaults if a "date" header is not filled in that .md file. Does anyone have a suggestion for this? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
https://mdsvex.com/docs#remarkplugins--rehypeplugins can be used to pull in |
Beta Was this translation helpful? Give feedback.
-
Most of your question in Svelte/mdsvex-specific btw — it looks like they have their own custom metadata place, and that they’re the ones that aren’t allowing you to use |
Beta Was this translation helpful? Give feedback.
-
Question was perfectly clear. Ok, I solved this using a simple plugin: function addStat() {
return (_, file) => {
file.data.fm.stat = fs.statSync(file.filename);
}
} Thanks. |
Beta Was this translation helpful? Give feedback.
Question was perfectly clear. Ok, I solved this using a simple plugin:
Thanks.