Tutorial: How to deploy a MkDocs static site on Azure #2192
Replies: 2 comments 3 replies
-
Thanks for sharing your solution! We try to keep the docs as concise as possible, so enumerating all possible quirks with different hosting providers is probably beyond the scope of this project. However, by providing your experience here, future users will have it easier to set up Material for MkDocs on Azure 🙏 |
Beta Was this translation helpful? Give feedback.
-
Hi JCS. I deployed a MKDOCS site to Azure (Azure Web App), and the search capability is not working. |
Beta Was this translation helpful? Give feedback.
-
I noticed this today, and it took me some time to find the issue. Contrary to most (if not all) web servers, Azure static sites handles the following URL's as separate URL's:
On most webservers nr.1 automatically redirects to nr.2 (see for example
mkdocs serve
) but Azure does not. The result is that most menu's give 404's when people visit the first URL, because the links are relative.I managed to solve this by adding a
<base href>
to the main template.Azure static sites btw, is when you create an Azure storage bucket and enable it for static web hosting. Combined with a CDN you can use it to cheaply host static websites.
I'm not sure if this is the best solution, but is it maybe an idea to mention it somewhere in the docs? Or maybe this ticket is enough :)
Beta Was this translation helpful? Give feedback.
All reactions