timlrx / tailwind-nextjs-starter-blog

This is a Next.js, Tailwind CSS blogging starter template. Comes out of the box configured with the latest technologies to make technical writing a breeze. Easily configurable and customizable. Perfect as a replacement to existing Jekyll and Hugo individual blogs.

Home Page:https://tailwind-nextjs-starter-blog.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for blog Pin to Top

CuB3y0nd opened this issue · comments

Add the priority attribute to blog posts and sort the blogs based on the value.

  • It is assumed that the lower the value, the higher the priority.
  • If empty, the default is to sort by release/modification time.

Implementation wise is relatively straightforward - add a new priority field to contentlayer and sort by priority and date.

Design wise is where it is tricky as I feel that there should be a change or notice to indicate that a particular post is pinned. Not sure if the current layout is the best for this. If you implement it on your end end, happy to add it to the list of blogs as a reference, but I don't think I will add it to the general repository.

Hi!

Another solution could be to add a featured section, with a "featured" field (instead of priority) set to true when needed.

If you want to implement this without making too many changes within the application, I think the best would be to create a "Featured" layout, and then import it into the desired page inside the app folder.

I think it is even possible not to show this new layout if there is no featured post, so the integration within the current application would be rather smooth.

Should be quite straightforward as well!

Hi!

Another solution could be to add a featured section, with a "featured" field (instead of priority) set to true when needed.

If you want to implement this without making too many changes within the application, I think the best would be to create a "Featured" layout, and then import it into the desired page inside the app folder.

I think it is even possible not to show this new layout if there is no featured post, so the integration within the current application would be rather smooth.

Should be quite straightforward as well!

Sounds like a good idea, I'll try it!

Hi!
Another solution could be to add a featured section, with a "featured" field (instead of priority) set to true when needed.
If you want to implement this without making too many changes within the application, I think the best would be to create a "Featured" layout, and then import it into the desired page inside the app folder.
I think it is even possible not to show this new layout if there is no featured post, so the integration within the current application would be rather smooth.
Should be quite straightforward as well!

Sounds like a good idea, I'll try it!

Hi again, if you want to have a look, I just implemented this on my i18n template!

Hi!
Another solution could be to add a featured section, with a "featured" field (instead of priority) set to true when needed.
If you want to implement this without making too many changes within the application, I think the best would be to create a "Featured" layout, and then import it into the desired page inside the app folder.
I think it is even possible not to show this new layout if there is no featured post, so the integration within the current application would be rather smooth.
Should be quite straightforward as well!

Sounds like a good idea, I'll try it!

Hi again, if you want to have a look, I just implemented this on my i18n template!

Woah, what a neat implementation! I will refer it, you really saved me a lot of trouble, thank you!