Automatic redirection in Antora

I have to reorganize a documentation from a flat-file structure (all adoc files in one directory) to subdirectory structure. But instead of leaving a 404 behind a would like to make an automatic redirection:
./pages/somefile.adoc → ./pages/subdir/somefile.adoc

For wiki pages there is a macro which does a redirection. Can I do something like that in Antorra as well? Something like

<head>
  <meta http-equiv='refresh' content='0; URL=/subdir/newaddress.adoc/'>
</head>

<body>
       <p>Page moved to <a href="/subdir/newaddress.adoc">tsubdir/newaddress.adoc</a>.</p>
</body>

Yes, you can!
https://docs.antora.org/antora/latest/page/page-aliases/

The only thing to remember is the alias definition goes on the new page, not the old one.
Using your provided example:
pages/somefile.adoc is deleted
and in pages/subdir/somefile.adoc, you add the :page-aliases: directive.
Something like:

:page-aliases: pages/somefile.adoc
3 Likes

Thanks! That is very easy and very smart.

I frequently look this one up too. It could be handy to call this out in the AsciiDoc for Fedora contributor guide section in the Docs Team docs:

I started to fix the links on Fedora documentation and tested it with our server pages first.

Obviously, I made a mistake I can’t find.

On the new server installation page at Fedora Server Installation Guide :: Fedora Docs Staging
(~/pages/installation/index.adoc) I have

= Fedora Server Installation Guide
Peter Boy; Kevin Fenzi; Jan Kuparinen
:page-authors: {author}, {author_2}, {author_3}
:page-aliases: pages/installation-an-introduction.adoc

Using
https://docs.stg.fedoraproject.org/en-US/fedora-server/installation-an-introduction/

I get a “page not found”

The page was stored at ~/pages/installation-an-introduction.adoc

What I’m doing wrong?

Right, sorry, my example was not the best one.
The aliases syntax uses the same rules as a standard xref link.
Long story short, you don’t need the pages/ part since this is the default location for antora to look at adoc documents.
Your current alias is still valid, but for this url (notice the extra /pages/):
https://docs.stg.fedoraproject.org/en-US/fedora-server/pages/installation-an-introduction/

Thanks. Indeed, the wrong address works right :slight_smile:

I just fixed and pushed my test case, let’s see.