docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

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

Open Josh-Cena opened this issue 4 years ago • 10 comments

🚀 Feature

Two things:

  • A new "created" metadata (using git history)
  • Allow manually feeding the "last updated" / "created" data in front matter when git history is not available / is messed up (e.g. #5598)

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 avatar Oct 12 '21 06:10 Josh-Cena

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.

slorber avatar Oct 12 '21 15:10 slorber

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 avatar Oct 22 '21 06:10 Josh-Cena

@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 avatar Apr 29 '22 09:04 Josh-Cena

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.

Josh-Cena avatar Apr 29 '22 09:04 Josh-Cena

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

dpang314 avatar May 18 '22 14:05 dpang314

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

Josh-Cena avatar May 18 '22 15:05 Josh-Cena

Will do.

dpang314 avatar May 18 '22 15:05 dpang314

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.

slorber avatar Jun 17 '22 10:06 slorber

Dear friends, I am very happy with your kindness. I hope that together we will achieve the desired results and have a very good recovery. Friends, if you have any problems, please send me a message. I will be very happy to be able to serve my loved ones. May our family and others take good advantage of this website and benefit from it. In the hope of health, happiness and happiness. Blessings, victory, pride and honor for all your loved ones and families. May your night and day be full of God's blessings and love. May you all be under the shadow of God's love and kindness.

alikazemi1259 avatar Sep 02 '22 01:09 alikazemi1259

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.

randallb avatar Sep 12 '22 21:09 randallb