Running Your Hugo Blog on Azure WebApp With Mime-types Json and Manifest

Intro

I switched some weeks ago over to another Hugo theme from Academic, and then someone attended me on the fact that my search on the site was not working. So I asked a question on the support forum of the Academic theme and got the direction to solved the problem.

By default when you run your Azure Web App on Windows the mime-types .json and .webmanifest are not configured so this means that they are not available on your website to the public.

Step-By-Step explained to fix it

You have to put the following in you web.config that is sitting in the wwwroot folder of your Azure Web App.

        <staticContent>
            <mimeMap fileExtension=".json" mimeType="application/json"/>
            <mimeMap fileExtension=".webmanifest" mimeType"application/manifest+json"/>
        </staticContent>

Because I deploy my blog generated with Hugo and use Azure DevOps with build and release pipelines to deploy it on Azure Web App running on Windows I put the web.config file in the ./static folder and the Hugo generator will put it in the wwwroot folder on the Azure Web App.

Conclusion

after adding the correct mime-types to the web.config file and deploy it with Azure DevOps to my Azure Web App by doing a Git commit and Push that triggered the CD/CI in Azure DevOps the search engine started to work again on my Blog.

See the following search for this blog item on the keyword mime-type

comments powered by Disqus