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

Last updated: feeding data through front matter, new "created" metadata #5691

Open
Josh-Cena opened this issue Oct 12, 2021 · 10 comments
Open
Assignees
Labels
domain: content plugin Related to content plugin emitting metadata for theme consumption feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this

Comments

@Josh-Cena
Copy link
Collaborator

🚀 Feature

Two things:

Have you read the Contributing Guidelines on issues?

Yes

Has this been requested on Canny?

Requested multiple times on Discord

Motivation

The "created" metadata can be used to differentiate between "new" pages and "deprecated" pages. "Last updated" shouldn't be entirely relying on git history since that can be buggy sometimes.

API Design

Front matter options:

last_update_time: Date | string
last_update_author: string
create_time: Date | string
create_author: string

New config options showCreateTime and showCreateAuthor

The implementation of "create time" shouldn't be too hard with git, but it can also be messed up in versioning, so🤷‍♂️ Front matter metadata FTW

Have you tried building it?

No

@Josh-Cena Josh-Cena added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Oct 12, 2021
@slorber
Copy link
Collaborator

slorber commented Oct 12, 2021

Agree that using frontmatter options to override defaults is a good idea.

With a createFrontMatter() option that I'd like to add, this would also allow users to provide their own code logic, eventually reading it from SVN/Mercurial/CMS/other systems.

@Josh-Cena
Copy link
Collaborator Author

I will probably build this feature myself after the createFrontMatter() landed, since then we can get rid of the hard-coded last updated generation method and just inject that as a default

@Josh-Cena
Copy link
Collaborator Author

Josh-Cena commented Apr 29, 2022

@slorber proposed in #7263 a similar API:

last_update:
  author: string
  date: string

I think that makes sense as well. We can possibly add other data in this namespace. Maybe we can even extend it to a history API if people want the last few revisions? (See #6218)

history:
  # First item: creation
  - author: ...
    date: ...
  - author: ...
    date: ...
  # Last item: last update
  - author: ...
    date: ...

@Josh-Cena Josh-Cena added good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this labels Apr 29, 2022
@Josh-Cena
Copy link
Collaborator Author

Now that createFrontMatter() is probably not coming through in the near future, we can implement this first, just without an automated way to fill it.

@dpang314
Copy link
Contributor

I would like to work on this. Should I implement the history or only the last update?

@Josh-Cena
Copy link
Collaborator Author

@dpang314 Let's start with a back-compatible lastUpdate first.

@dpang314
Copy link
Contributor

Will do.

@slorber
Copy link
Collaborator

slorber commented Jun 17, 2022

A new "created" metadata (using git history)

The "created" metadata can be used to differentiate between "new" pages and "deprecated" pages.

As we discussed on discord, I'm not sure to understand the use-case for this 🤪

In any case, making it possible for users to access a "created" metadata might have some benefits, just not sure to understand yet how it would be used in practice.

@alikazemi1259

This comment was marked as spam.

@randallb
Copy link

Hi-- I'm interested in working on this. It seems like it would be pretty simple... yeah? I'll give it a shot over the next lil' bit and let you know how far I get.

@slorber slorber added apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee and removed apprentice Issues that are good candidates to be handled by a Docusaurus apprentice / trainee labels Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: content plugin Related to content plugin emitting metadata for theme consumption feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. good first issue If you are just getting started with Docusaurus, this issue should be a good place to begin. status: accepting pr This issue has been accepted, and we are looking for community contributors to implement this
Projects
None yet
Development

No branches or pull requests

5 participants