thien-do / memos-pub

Markdown Blogging, Without Setup or Signup
https://memos.pub
116 stars 21 forks source link

feat(blog): Support date in title #19

Closed thien-do closed 2 years ago

thien-do commented 2 years ago

Some blogs have date in their article titles:

Screen Shot 2022-03-19 at 10 44 54 AM

At the moment there is no special treatment for them. However we'd like to separate them visually from the rest of the title, like this:

Screen Shot 2022-03-19 at 10 46 45 AM

Not all blog uses the same format, or have date, so we just try to support yyyy mm dd, and do nothing if none match:

yyyy-mm-dd title
yyyy/mm/dd title
yyyy.mm.dd title

So I guess the regex is:

^\d{4}[-/.]\d{2}[-/.]\d{2} 
Screen Shot 2022-03-19 at 10 44 39 AM

The change should happen around here:

https://github.com/thien-do/memos-pub/blob/2601f453bac69d2440a68dfa16b260626fccfc7b/lib/blog/dir/entry.tsx#L17-L21

lqt93 commented 2 years ago

I would like to take this, please.

thien-do commented 2 years ago

Thanks @lqt93 👍

thien-do commented 2 years ago

Done