Base url for HTML docs

18 views
Skip to first unread message

Andrew Scholer

unread,
Jun 16, 2026, 7:51:39 PM (13 days ago) Jun 16
to prete...@googlegroups.com
Mostly for Rob...

I need to set a <base> element in the <head> of some HTML pages with the document's base url on Runestone builds.

It looks like the base URL doesn't exist as a standalone template for RS books. The closest is in the canonical-link template, which makes a local site-root variable.

I can just copy that logic, but it looks like there is a TODO, attached to it, so maybe this is a spot to rework?

There is of course baseurl, which is closely related, but we don't seem to expect RS authors to set that manually.

Would it make sense to promote site-root to global? Or maybe we should we automatically set $baseurl for Runestone books? Or make some new thing?



Sean Fitzpatrick

unread,
Jun 16, 2026, 8:10:56 PM (13 days ago) Jun 16
to PreTeXt development
The baseurl is set in the publisher file, so the publisher file for Runestone could be configured to point to the right place. 

But it just occurred to me that I have not done this with APEX (or my other book on Runestone)!

However, this was likely due to ignorance of what the correct URL should be on Runestone. On the off chance that this is not just me, perhaps it would make sense to set the base URL automatically for Runestone builds. 
(Then my follow-up question is about what happens when the book is on a local Runestone server!)

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/CACm44N-iNrYutBn7RAnn-6S%3DDAy_qEcURxk9zFPX5V0cc4pL0A%40mail.gmail.com.

Andrew Scholer

unread,
Jun 17, 2026, 2:24:35 PM (12 days ago) Jun 17
to prete...@googlegroups.com
Yes, if there is a baseurl, it would make sense to assume that it is the base to use. That way books on local Runestone servers can point to their own base.

But, absent a baseurl, how should I manufacture the default URL? That is the part that may intersect with the existing code and TODO note.



Andrew Scholer

unread,
Jun 22, 2026, 4:31:08 PM (7 days ago) Jun 22
to PreTeXt development
OK, a formal proposal:

We assume that the pub var #html/baseurl in a book being hosted on Runestone will point to the root of the book.

That will be used to generate canonical links and to set a <base> in the HTML. 

If there is no #html/baseurl, we use:
That is the string currently hardcoded in the canonical link code.

This will enable authors publishing to non-runestone.academy runestone servers to generate correct canonical links. And it will allow the code I am working on to generate a correct <base> in the HTML.
Reply all
Reply to author
Forward
0 new messages