By default, Jekyll uses the date you use in the filename, just as you suggested, so 2024-08-01-article-2.md
is read by Jekyll, and then when it displays the posts, it uses that date.
However, your post should also have a date
field in the YAML front matter. You will find that when you create a new blank Jekyll site, it includes that field. This is a best practice, especially for people like you who may post more than once a day and care about how the file gets displayed.
Using the date field, you can use this format:
date: 2024-08-01
In your case, that does not help a lot because you want more granularity, so you can extend the date format like this, which includes HH:MM;SS
date: 2024-08-01 02:05:54
Technically, Jekyll uses ISO8601, which means you can extend the date to the UTC timezone offset. For example, I live in California, which is -7 hours from UTC, so I represent the date like this:
date: 2024-07-31 19:05:54 -0700
Here is what you should minimally do so you get the sorting right, assuming article 1 was written first and article 2 was written second:
2024-08-01-article-1.md
:
---
layout: single
title: article-1
date: 2024-08-01 02:01:00
excerpt:
seo_title:
seo_description:
categories:
tags:
---
The content goes here...
2024-08-01-article-2.md
:
---
layout: single
title: article-2
date: 2024-08-01 02:02:00
excerpt:
seo_title:
seo_description:
categories:
tags:
---
The content goes here...