Missing Last changed: in README.md's #10

Open
opened 2024-10-27 14:23:36 +00:00 by bartvanderwal · 1 comment
bartvanderwal commented 2024-10-27 14:23:36 +00:00 (Migrated from github.com)

Great repo! This helped me achieve what I wanted too for a large part, without needing to build it myself.

I have three feature requests though of which the first one might be considered a bug report. And the main one.

  1. It works on most pages, but I am missing a Last change in README.md files, which mdbook automatically converts to index.html on building. See for instance in the mdbook codebase here. I suppose as a work-around I could rename all these files to index.md, but then they aren't shown in GitHub anymore by default. Could mdbook-lastchange retrieve the last change date in git of a README.md'a and use/insert that on the matching index.html?

TL; DR / Other suggestions

I might look at these other two suggestions myself. Perhaps should make another separate issue(s) for them.

Edit 9-11-2024: Suggestion 2 below was moved to issue #11 , and suggestion 3 was denied, might be a possible fork.

  1. The text Last changed: 2021-11-05 is fine as a default, but could it also be made configurable, so I can localize it for Dutch? For instance a second setting last-changed-text besides git-repository-url. Ideally also with a variable position of the date. So you could also change it to a more verbose "This page was last changed on 2024-22-12" to make explicit that the data is per page, and not per website. "Diese Seite wurde zuletzt am 2024-22-12 geändert"

  2. It would be great - and I think also pretty logical - if this plugin could also generate a sitemap.xml file of all the pages and use the determined dates as value for the lastmod property. The existing mdbook-generate-sitemap creates a sitemap, but is missing the lastmod valuea, but also seems to be a bit abandoned, or never really to have left the ground, as Google webmaster tools finds immediate errors. And the repo has this issue reported for it, but also an open pull request with a fix for it thas is open and unmerged for 10 months.

Here is an small example of a sitemap.xml

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://minordevops.nl</loc>
    <priority>1.0</priority>
    <lastmod>2021-11-05</lastmod>
  </url>
  <url>
    <loc>https://minordevops.nl/testing.html</loc>
    <priority>1.0</priority>
    <lastmod>2024-10-27</lastmod>
  </url>
<urlset>
Great repo! This helped me achieve what I wanted too for a large part, without needing to build it myself. I have three feature requests though of which the first one might be considered a bug report. And the main one. 1. It works on most pages, but I am missing a `Last change` in `README.md` files, which mdbook automatically converts to `index.html` on building. See for instance in the [mdbook codebase here]( https://github.com/rust-lang/mdBook/blob/684bb788976c278ed7f1731fbe7165e357b3d1fe/guide/src/format/markdown.md?plain=1#L93). I suppose as a work-around I could rename all these files to `index.md`, but then they aren't shown in GitHub anymore by default. Could mdbook-lastchange retrieve the last change date in git of a `README.md`'a and use/insert that on the matching `index.html`? ## TL; DR / Other suggestions I might look at these other two suggestions myself. Perhaps should make another separate issue(s) for them. Edit 9-11-2024: Suggestion 2 below was moved to issue #11 , and suggestion 3 was denied, might be a possible fork. 2. The text `Last changed: 2021-11-05` is fine as a default, but could it also be made configurable, so I can localize it for Dutch? For instance a second setting `last-changed-text` besides `git-repository-url`. Ideally also with a variable position of the date. So you could also change it to a more verbose "This page was last changed on 2024-22-12" to make explicit that the data is per page, and not per website. "Diese Seite wurde zuletzt am 2024-22-12 geändert" 3. It would be great - and I think also pretty logical - if this plugin could also generate a `sitemap.xml` file of all the pages and use the determined dates as value for the `lastmod` property. The existing `mdbook-generate-sitemap` creates a sitemap, but is missing the `lastmod` valuea, but also seems to be a bit abandoned, or never really to have left the ground, as Google webmaster tools finds immediate errors. And the repo has [this issue](https://github.com/rxdn/mdbook-sitemap-generator/issues/2) reported for it, but also an open pull request with a fix for it thas is open and unmerged for 10 months. Here is an small example of a `sitemap.xml` ```xml <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://minordevops.nl</loc> <priority>1.0</priority> <lastmod>2021-11-05</lastmod> </url> <url> <loc>https://minordevops.nl/testing.html</loc> <priority>1.0</priority> <lastmod>2024-10-27</lastmod> </url> <urlset> ```
badboy commented 2024-10-29 10:30:39 +00:00 (Migrated from github.com)

The first issue should be easy to handle: when the filename is index.html (or index.md? whatever mdbook gives us...) look for README.md too (now what to do about all the different casings of that ...).
A check somewhere here might be the way to do it: badboy/mdbook-last-changed@4f5518a1bd/src/lib.rs (L94)

Your last-changed-text request seems appropriate, but please split it out into a separate issue.
The sitemap request: Nah, that's out of scope for this simple preprocessor. I don't want to maintain that. So if you need that feel free to fork and add the functionality yourself.

The first issue should be easy to handle: when the filename is `index.html` (or `index.md`? whatever mdbook gives us...) look for `README.md` too (now what to do about all the different casings of that ...). A check somewhere here might be the way to do it: https://github.com/badboy/mdbook-last-changed/blob/4f5518a1bd8d06bf3ab79d9318ea7da5133cbf68/src/lib.rs#L94 Your `last-changed-text` request seems appropriate, but please split it out into a separate issue. The sitemap request: Nah, that's out of scope for this simple preprocessor. I don't want to maintain that. So if you need that feel free to fork and add the functionality yourself.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jer/mdbook-last-changed#10
No description provided.