Welcome to the Part II of the series, Creating a new blog post (individual & series)
to create a new blog, create a folder with the slug you want and create a page.md
file. the slug will act as the blog url which will be /blog/[slug]
here's the tree view of the folder structure
Note: Do not add any spaces, separate the name using
-
Frontmatter allows you to specify metadata and options. Included in frontmatter are things like the document or project title, what thumbnail to use for site or content previews, authors that contributed to the work etc,
for this template the frontmatter is
tags
is an array so if you want to declare multiple tags just add a new tag below it.
To understand Series Blogs, you need to understand the folder structure first.
for page.md
this is same as the one for individual blog posts and for actual posts in the series, the frontmatter is little different.
We have a new property called order
, which indicates the order of the particular post in that series. Additionally, image
and tags
are completely optional. If you do not specify them, the values from the cover folder (page.md
) are used. However, if you do specify them, the specified values are used instead. When it comes to tags, if you specify them, the tags from the specific post are combined with the tags declared in page.md
. This is particularly useful when you're writing a long series and each post is on a different topic. For example, if you're writing a Machine Learning Series, at some point, you're writing a post on Clustering algorithms, so that specific post should have its own tag.
for series blogs, the slug will be cover folder
+ a unique identifier
+ name of the .md file
This blog uses rehype-pretty-code and shiki for syntax highlighting with two different themes for light and dark mode. To configure code blocks to your style, take a look at mdsvex.config.js
, pre.svelte
and markdown.postcss
files.
You can create fenced code blocks by placing triple backticks ```
before and after the code block. Place a blank line before and after code blocks to make the raw formatting easier to read.
To display triple backticks in a fenced code block, wrap them inside quadruple backticks.
if you provide a title with an extension, the code block will look like
for rendering icons, it grabs the extension and maps it to the icon for that language. Again, you can totally change this behaviour in pre.svelte
which is a custom component.
you can also do inline syntax highlighting. To use that
this will become
System.out.println("This is a example of Inline Syntax Highlighting")
you can highlight individual words in your code with different colors.
this will become
for other languages, like js or ts
this will become
for rendering math equations, i gave a detailed explanation here . Earlier it wasn't possible to add inline equations without using an external component but I created a plugin that allows you to insert inline math equations.
here's the plugin
to write inline equations use $$ $$
and wrap your KaTeX inside.
this becomes
for block equations
this becomes
in the next part, we'll look at other configurations.