Giter Club home page Giter Club logo

Comments (2)

Alerinos avatar Alerinos commented on May 23, 2024 1

@HTTPThanhLuan You can use this method as well.

        <environment include="Staging,Production">
            <base href="/prod/" />
        </environment>
        <environment include="Development">
           <base href="/dev/" />
        </environment>

from toolbelt.blazor.headelement.

jsakamoto avatar jsakamoto commented on May 23, 2024

@HTTPThanhLuan

Unfortunately, the duty of changing the HTML base tag is over the cover area of this library.

However, you can change the HTML base tag dynamically in various ways.

  1. If your Blazor app is a Blazor Server app or an ASP.NET Core hosted Blazor WebAssembly app, you can change HTML base tag dynamically based on pre-rendering technic with the ASP.NET Core Razor Pages feature or ASP.NET MVC Views feature.
    see also: https://learn.microsoft.com/aspnet/core/blazor/components/prerendering-and-integration

  2. If your Blazor app is a Blazor WebAssembly app and you want to deploy it on GitHub Pages, you don't need to worry about how to change the HTML base tag. What you should do is only add the "PublishSPAforGitHubPages.Build" the NuGet package to your project. That package will take care of changing the HTML base tag automatically instead of you.
    see also: https://www.nuget.org/packages/PublishSPAforGitHubPages.Build#readme-body-tab

  3. If your Blazor app is a Blazor WebAssembly app, you can also configure your project (MSBuild script) to change the HTML base tag in the wwwroot/index.html in your project automatically by shell script every time you publish it.
    (I don't have examples how to implement this way)

  4. If your production environment is only one URL (you don't have more than one production environment), you can also configure your development environment's HTML base tag to be aligned with the production environment's. Actually, you don't need to stick the development environment base URL to be the root "/" URL.
    see also: https://learn.microsoft.com/aspnet/core/blazor/host-and-deploy/

Are there any options in the above list to fit your case?

from toolbelt.blazor.headelement.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.