-
Notifications
You must be signed in to change notification settings - Fork 2
Posts
Posts in Volcano are written in Markdown and placed in the site/posts directory. If you are familiar with Pages you will recognize Posts.
Posts and Pages are pretty much the same with the difference of where you put the Markdown files you write.
The reason for Posts to exist is simply a question of separating the concerns. With Posts being in its own directory makes it easier to create methods like getEntries('posts') which get all Posts from the POSTS directory in an array, which later can be presented as a list of all your blog posts.
If Posts did not live in their own directory you would have to specify what type, either Page or Post, you were composing in form of a metadata tag in the header. The directory structure seems easier. Right?
Pages will take precedence over Posts. That means if you have a file located at site/pages/hello-world.md and another one located at site/posts/hello-world.md Volcano will serve the page over the post.
You can organize all your posts in subdirectories like so:
- site
- posts
- sub1
my-post-in-sub1.md
- sub2
another-nested-post.md
this-is-second-post.md
post-not-in-sub.md
another-not-in-sub-post.mdThe way you structure your Posts will reflect on how you access them:
site/posts/sub1/my-post-in-sub1.md -> https://your-domain.com/sub1/my-post-in-sub1
site/posts/post-not-in-sub.md -> https://your-domain.com/post-not-in-subThe filename of your post equals the URL it can be accessed at. For example, a file called my-fist-post.md will be accessible at http://my-website.com/my-first-post.
That also means that the filename should be all lowercase with - instead of spaces.
In Volcano you can specify metadata of a Post in the form of comments put like this:
<!--
* Title: My first post
* Description: This is the description
* Written: 01/01/20 10:32:49
-->
# This is my first post
It is written in Markdown and served by Volcano🎉Metadata can later be printed out in a theme via the getMeta(string $type) method on the Volcano class.