linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] docs: new scripts to generate HTML redirects
@ 2025-09-05 14:46 Vegard Nossum
  2025-09-05 14:46 ` [PATCH v2 1/3] docs: add tools/docs/gen-renames.py Vegard Nossum
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Vegard Nossum @ 2025-09-05 14:46 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: linux-doc, Mauro Carvalho Chehab, Konstantin Ryabitsev,
	Vegard Nossum

Hi,

When we rename an .rst file, that also changes the URL for the document
at https://docs.kernel.org/ and results in a 404, which can be anonying
for people who bookmark URLs and/or follow links from search engines
and old changelogs and emails.

In order to be able to fearlessly rename individual documentation files
and reorganize Documentation/, add two scripts:

- tools/docs/gen-renames.py : use git to figure out which .rst files
  have been renamed

- tools/docs/gen-redirects.py : actually generate .html stubs for the
  locations, redirecting to the new locations

The reason for splitting this into two is that trawling git history is
slightly slow (on the order of 20-30 seconds on my laptop) whereas just
generating the HTML files is very fast. This also allows us to cache
the historical renames in Documentation/.renames.txt or add manual
fixups as needed.

Changes since v1:

- cover letter
- move files from scripts/ -> tools/docs/
- add SPDX lines
- program doc strings + improved --help


Vegard

---

Vegard Nossum (3):
  docs: add tools/docs/gen-renames.py
  docs: add Documentation/.renames.txt
  docs: add tools/docs/gen-redirects.py

 Documentation/.renames.txt  | 1191 +++++++++++++++++++++++++++++++++++
 Documentation/Makefile      |    4 +
 Makefile                    |    5 +-
 tools/docs/gen-redirects.py |   54 ++
 tools/docs/gen-renames.py   |  130 ++++
 5 files changed, 1382 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/.renames.txt
 create mode 100755 tools/docs/gen-redirects.py
 create mode 100755 tools/docs/gen-renames.py

-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-04 16:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-05 14:46 [PATCH v2 0/3] docs: new scripts to generate HTML redirects Vegard Nossum
2025-09-05 14:46 ` [PATCH v2 1/3] docs: add tools/docs/gen-renames.py Vegard Nossum
2025-09-05 14:46 ` [PATCH v2 2/3] docs: add Documentation/.renames.txt Vegard Nossum
2025-09-05 14:46 ` [PATCH v2 3/3] docs: add tools/docs/gen-redirects.py Vegard Nossum
2025-09-09 19:41 ` [PATCH v2 0/3] docs: new scripts to generate HTML redirects Jonathan Corbet
2025-11-04 16:44   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).