Jekyll Helper - My VSCode Extension
Info
I’d like to share my VSCode extension, Jekyll Helper. It automates my process of adding dates, renaming files based on titles, and moving drafts to the _posts directory. What used to take several manual steps now happens automatically, freeing up more of my time.
I don’t see myself as a professional programmer, just someone who does a little bit of scripting here and there. I was just interested in writing an extension that makes it easier for me to create my Jekyll drafts and posts.
What I have learnt
- Creating VSCode extensions with Typescript
- Using AI tools in my programming process
- Diving deeper into Git
- Publishing the extension
Credits
The extension is based on Nor-s/front-matter-gen, itself a fork of Abdillah/vscode-belikejekyll and rohgarg/jekyll-post.
Changes Made
- Added “Title Case” Function: Implemented functionality to convert titles to title case in the front matter.
- Added Draft Button: Introduced a button for creating new drafts.
- Added Publish Button: Created a button for publishing drafts as posts.
- Implemented Filename Uniqueness Checks: Ensured unique filenames by adding numeric suffixes (e.g., ‘-1’).
- Refactored and Sanitized Core Source Code: Improved, extended, and cleaned up the core code.
- Modified Date Filename Pattern and File Extension Configuration: Updated the filename format to include dates and customized file extension handling.
Features
- New Explorer Context Menu Options:
- New Jekyll Post: Creates a new blog post with front matter.
- New Jekyll Draft: Creates a draft with front matter.
- Publish Jekyll Draft:
- Checking if there are unsaved changes in the draft file before proceeding.
- Adding the current date to both the filename and the front matter.
- Updating the filename based on the title specified in the front matter.
- Moving the file to the _posts directory.
- Automatic Filename Generation:
- Adds the current date in
YYYY-MM-DD
format. - Sanitizes the title by replacing spaces with hyphens and converting it to lowercase.
- Checks for filename uniqueness and adds numeric suffixes if necessary (e.g.,
-1
,-2
).
- Adds the current date in
- Title Case Conversion: Automatically converts the user-provided title into Title Case in the front matter.
- Customizable Templates: Allows the use of custom templates for new posts and drafts. If no template is provided, a built-in default template is used.
Perhaps this will be useful for you too. I’ve published it on the VSCode Marketplace and on GitLab you can find the source code. I also explain how to use Jekyll Helper there.