content icon indicating copy to clipboard operation
content copied to clipboard

Add short-title for all JS class members

Open caugner opened this issue 7 months ago • 1 comments

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration

What specific section or headline is this issue about?

Sidebar

What information was incorrect, unhelpful, or incomplete?

The sidebar for Temporal objects repeats the full object name ("Temporal.X") for every entry.

What did you expect to see?

I would expect the sidebar to have short entries, e.g. add() instead of Temporal.Duration.prototype.add().

Do you have any supporting links, references, or citations?

This affects all Temporal objects, linked in the Temporal page's sidebar under Related pages.

Adding short-title should fix this.

Do you have anything more you want to share?

ImageImage

MDN metadata

Page report details
  • Folder: en-us/web/javascript/reference/global_objects/temporal/duration
  • MDN URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration
  • GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/javascript/reference/global_objects/temporal/duration/index.md
  • Last commit: https://github.com/mdn/content/commit/3dbbefa32758e2a1ca9a37c2788370c06aae2738
  • Document last modified: 2025-03-06T15:48:08.000Z

caugner avatar Jun 13 '25 15:06 caugner

OK, but this is the JS convention. If we want to do this (which I'm +1), we need to do this for all pages.

Josh-Cena avatar Jun 13 '25 16:06 Josh-Cena

Hello @caugner, @Josh-Cena I think I can resolve this issue by creating a script that will run and check each file, adding a short-title if it doesn't already exist. The script will do the following

1. Read all the docs
2. Extract metadata
3. Filter out the files that already have `short-title`
4. Extract the title
5. Convert it to a `short-title`
6. Insert it

We can also use regular expressions for extractions.

Bashamega avatar Jun 19 '25 09:06 Bashamega

For now, let's only do that for class members (methods & properties). A regex replace sounds fine to me.

Josh-Cena avatar Jun 19 '25 11:06 Josh-Cena