Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat($plugin-last-updated): add "$page.lastUpdatedTimestamp" #2843

Closed
wants to merge 1 commit into from

Conversation

Kocal
Copy link
Contributor

@Kocal Kocal commented May 5, 2021

Summary

Some plugins depends of $page.lastUpdated to get the last updated date of a document, example https://github.com/lorisleiva/vuepress-plugin-seo or https://github.com/ekoeryanto/vuepress-plugin-sitemap.

However, due to the changes on the default transformer which adds support for localized date, passing a lang in the frontmatter header (ex: lang: fr) returns a string formatted like this 04/05/2021 à 23:29:04 which can't be parsed through new Date(), see lorisleiva/vuepress-plugin-seo#9 or https://github.com/ekoeryanto/vuepress-plugin-sitemap/blob/master/index.js#L24.

I don't think it's a nice idea to pass a custom transformer which just return the timestamp, because it means people will have to use theme inheritance just for re-formatting a localized date.

Instead, adding a new key lastUpdatedTimestamp which now contains the raw timestamp value without any transformation on it, in order to be easily used by other plugins.

WDYT?

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

@GregoireF
Copy link

Hi @Kocal,

I think your request can be closed.

Here is the working:
2345902#diff-9d5c9ea6cf449744a6a0f1d0d8dacf7a1aec22e97b1404b33eb8fa598ff3b9e2

Thanks for your implication ❤️

Cheers,

Gregoire FAVREAU

@Kocal
Copy link
Contributor Author

Kocal commented Jan 21, 2022

Perfect! :)

@Kocal Kocal closed this Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants