docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

feat(content-docs): new "created" metadata

Open dpang314 opened this issue 2 years ago • 5 comments

Pre-flight checklist

  • [x] I have read the Contributing Guidelines on pull requests.
  • [x] If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • [x] If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

This feature allows displaying the date that documentation was created. It uses Git history, but can be overridden through front matter. It addresses the second half of #5691.

Sometimes the wording is a bit awkward, since last update is a noun, but create isn't, but I used create/created for consistency. creation fits better grammatically in a few spots, but I don't know if that would be preferable if it breaks consistency.

Test Plan

Added unit tests for front matter configurations, including:

  • create front matter undefined
  • Author undefined but date valid
  • Author valid but date undefined
  • Invalid date strings
  • Both valid with varying date string formats

Created doc unit tests

  • Front matter overrides Git history
  • Front matter with only author uses Git history for date
  • Front matter with only date uses Git history for author
  • Front matter is not shown when config disables it

Dogfooding

  • Created new page with create set with front matter
  • Create time/author generated by Git history can be seen on the other dogfooding pages

Test links

Deploy preview: https://deploy-preview-7588--docusaurus-2.netlify.app/ Dogfooding page: https://deploy-preview-7588--docusaurus-2.netlify.app/tests/docs/doc-with-create/ Dogfooding page with create from Git history: https://deploy-preview-7588--docusaurus-2.netlify.app/tests/docs/ Documentation: https://deploy-preview-7588--docusaurus-2.netlify.app/docs/api/plugins/@docusaurus/plugin-content-docs/

Related issues/PRs

#5691

dpang314 avatar Jun 09 '22 14:06 dpang314

[V2]

Built without sensitive environment variables

Name Link
Latest commit 99ded9d6f8af0250688bf9f0ce0ab74654cab54b
Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62bd69fa3bedbb00090c1bc2
Deploy Preview https://deploy-preview-7588--docusaurus-2.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Jun 09 '22 14:06 netlify[bot]

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟢 90 🟢 100 🟢 100 🟢 100 🟢 90 Report
/docs/installation 🟠 82 🟢 99 🟢 100 🟢 100 🟢 90 Report

github-actions[bot] avatar Jun 09 '22 14:06 github-actions[bot]

@dpang314 do you want to follow-up on this? Otherwise I'll complete your work and move on

slorber avatar Aug 09 '22 10:08 slorber

@slorber I think that all the issues have been addressed, but I wanted to confirm the best way to handle this issue.

dpang314 avatar Aug 16 '22 15:08 dpang314

sorry missed the commits, will review later ;)

slorber avatar Aug 16 '22 16:08 slorber