HiDeoo / starlight-blog

Starlight plugin to add a blog to your documentation
https://starlight-blog-docs.vercel.app
MIT License
126 stars 17 forks source link

the updateDate and lastUpdated should have the same value #66

Closed sanabel-al-firdaws closed 2 months ago

sanabel-al-firdaws commented 2 months ago

Describe the bug

I am currently using the lastUpdated global config so under every page there is a lastUpdated date

it would be nice if they both had the same value

To Reproduce

  1. turn on LastUpdated in Astro config
  2. the date is shown when you scroll down insted of next to the link

Expected behavior

when turning on LastUpdated global config it should show the date up not down

How often does this bug happen?

Every time

System Info

No response

Additional Context

No response

HiDeoo commented 2 months ago

Thanks for the feedback :raised_hands:

Starting with the version 0.11.0 of the plugin, only lastUpdated will be used to display the last update date of a post near the date of publication.

sanabel-al-firdaws commented 2 months ago

thank you for your great work on both starlight and the plugins ✨♥️♥️!

sanabel-al-firdaws commented 2 months ago

when using LastUpdated in the frontmatter it works now 👍 it shows the lastUpdated twice up and down

but when using the global config in Astro config while not using LastUpdated in frontmatter nothing shows up....under the page there is LastUpdated date but up there is nothing Screenshot_20240705_134455

Screenshot_20240705_134101

Screenshot_20240705_134949

also its better to use the 18n labels for 'page.lastUpdated' like its used by starlight users don't need to set it manually ....i think you can just copy paste the starlight ui component for lastUpdated

and maybe add one for tags and all posts and recent posts Screenshot_20240705_135506

HiDeoo commented 2 months ago

but when using the global config in Astro config while not using LastUpdated in frontmatter nothing shows up

This is indeed the case by design, to offer the choice to users to explicitly opt-in to show an update next to the publication date and I also got feedback that some users would prefer not to have an update date for their blog posts automatically matching the git commit date.

also its better to use the 18n labels for 'page.lastUpdated'

There is an ongoing refactor of the entire i18n mechanism in Starlight with first-class support for plugins (which are currently mostly i18n less). My plan is to only start working on i18n in plugins when the new i18n implementation is ready and released to avoid inventing an API that will end up being deprecated in a few weeks.

sanabel-al-firdaws commented 2 months ago

I also got feedback that some users would prefer not to have an update date for their blog posts automatically matching the git commit date.

adding an option for turning the auto lastUpdated date on and having the default off just like its in starlight config might be the middle solution

starlightBlog({ lastUpdated: true )}

HiDeoo commented 2 months ago

adding an option for turning the auto lastUpdated date on and having the default off just like its in starlight config might be the middle solution

Yeah, I'm always hesitant on adding options but it's definitely a possibility. I think with a bit of time and based on potential feedback, we can figure out what the best solution would be.