Enhancement: Post processing script on content type #300

Closed
opened 2026-10-05 02:38:44 +02:00 by adam · 3 comments
Owner

Add the ability to reference a script that will be executed after content creation happened.

Add the ability to reference a script that will be executed after content creation happened. <!-- github-sync-id:1319322278 -->
adam closed this issue 2026-10-05 02:38:44 +02:00
Author
Owner

I would add a complete "hook system" where we can reference scripts on several activities/events, but post-creation comes to mind first.

I would add a complete "hook system" where we can reference scripts on several activities/events, but post-creation comes to mind first. <!-- github-comment-id:1196616158 -->
Author
Owner

I have a specific use case in mind: I have a content type that is basically a youtube video. When creating that post I would want to retrieve that videos thumbnail as a preview image to be saved next to the markdown file of the content. Currently I am doing that via creating the content > manual action with frontmatter button.

I would think that is what this feature might be about?

I have a specific use case in mind: I have a content type that is basically a youtube video. When creating that post I would want to retrieve that videos thumbnail as a preview image to be saved next to the markdown file of the content. Currently I am doing that via creating the content > manual action with frontmatter button. I would think that is what this feature might be about? <!-- github-comment-id:1198262668 -->
Author
Owner

@davidsneighbour correct, that is my use case as well.

The postscript functionality is now available in the latest beta.

Here is what you need to do:

Create a script

The postscript functionality uses the content scripts from the frontMatter.custom.scripts settings. All you have to do is add a new id property to the script.

{
  "frontMatter.custom.scripts": [
    {
      "id": "generate-social-image",
      "title": "Generate social image",
      "script": "./scripts/social-img.js",
    }
}

Info: If you want to hide the script/action from the UI, you can add a property hidden and set it to true.

Define the postscript in the content type

The content type has a new property called: postScript, which requires the id of the script to execute.

@davidsneighbour correct, that is my use case as well. The postscript functionality is now available in the latest beta. Here is what you need to do: **Create a script** The postscript functionality uses the content scripts from the `frontMatter.custom.scripts` settings. All you have to do is add a new `id` property to the script. ```json { "frontMatter.custom.scripts": [ { "id": "generate-social-image", "title": "Generate social image", "script": "./scripts/social-img.js", } } ``` > **Info**: If you want to hide the script/action from the UI, you can add a property `hidden` and set it to `true`. **Define the postscript in the content type** The content type has a new property called: `postScript`, which requires the `id` of the script to execute. <!-- github-comment-id:1205259002 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#300