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

Add $page.lastUpdatedTstamp #1778

Merged
merged 2 commits into from
Dec 20, 2021

Conversation

psi-4ward
Copy link
Contributor

Summary

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:

The $page.lastUpdated generated from plugin-last-updated helds the Date in the localized format. Other plugins like sitemap can hardly work with this value in a mathematics manner so it's necessary to also expose the Timestamp.

See ekoeryanto/vuepress-plugin-sitemap#11

@flozero
Copy link
Collaborator

flozero commented Sep 5, 2019

Hello @psi-4ward ! Thank's for you PR

@@ -10,6 +10,7 @@ module.exports = (options = {}, context) => ({
? transformer(timestamp, $lang)
: defaultTransformer(timestamp, $lang)
$page.lastUpdated = lastUpdated
$page.lastUpdatedTstamp = timestamp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add the full name here lastUpdatedTimestamp lastUpdatedTimeStamp for me it could a lot more clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho is tstamp a very common term for the Unix (like) time stamp but I will adjust it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe others can answer too. Actually i dont see any short write of variable inside vuepress.

@flozero flozero added status: community assigned Community assigned topic: config Relates to VuePress config topic: plugins Relates to VuePress plugins type: enhancement Request to enhance an existing feature version: 1.x Relates to version 1 of VuePress labels Sep 5, 2019
@psi-4ward
Copy link
Contributor Author

Updated to lastUpdatedTimestamp

@flozero flozero requested a review from kefranabg September 10, 2019 23:33
Copy link
Collaborator

@kefranabg kefranabg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @psi-4ward

Thanks for this PR.

Why would you need to access the timestamp as you can already change the date format through a custom transformer ?

@kefranabg kefranabg added the need feedback Awaiting author response label Sep 20, 2019
@psi-4ward
Copy link
Contributor Author

The transformer gets used to formatpage.lastUpdated but probably we need other date-formats too - see the vuepress-sitemap-plugin. A correct sitemap.xml needs an ISO-String which can only hardly derived from the local date string.

@kefranabg
Copy link
Collaborator

What you mean is that you need to have two types of date format in the same page right?

@kefranabg
Copy link
Collaborator

What you want seems very specific to your need. Could theme inheritance solve your problem?

@psi-4ward
Copy link
Contributor Author

What you mean is that you need to have two types of date format in the same page right?

Not necessarily in the same page. More generic there sould be a possibility to have the date in a machine-readable format. The sitemap-plugins generates a XML of all pages with ISO-Date of the laste-updated date. Another usecase would be a smth like an article-list (blog) with dates like "1 day ago".

@vue-bot
Copy link

vue-bot commented Sep 30, 2019

Hello!
This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues requiring feedback after 20 days of inactivity. It’s been at least 10 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. (A maintainer can also add the label not stale to keep this issue open.)

Thanks for being a part of the Vue community! 💪💚️

@kefranabg kefranabg removed the need feedback Awaiting author response label Sep 30, 2019
@vue-bot
Copy link

vue-bot commented Oct 10, 2019

Hey again! 😸️

It’s been 20 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. 🤖 Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Vue community! 💚️

Copy link
Member

@ulivz ulivz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help update the relevant documentation?

@psi-4ward
Copy link
Contributor Author

@psi-4ward psi-4ward closed this Oct 21, 2019
@psi-4ward psi-4ward reopened this Nov 13, 2019
@psi-4ward
Copy link
Contributor Author

Issue still valid: ekoeryanto/vuepress-plugin-sitemap#11

@psi-4ward
Copy link
Contributor Author

Could you help update the relevant documentation?

Can you give me a hint where to document this?

Copy link
Member

@ulivz ulivz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ulivz ulivz merged commit 2345902 into vuejs:master Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not stale status: community assigned Community assigned topic: config Relates to VuePress config topic: plugins Relates to VuePress plugins type: enhancement Request to enhance an existing feature version: 1.x Relates to version 1 of VuePress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants