Training
Learning path
Azure Static Web Apps - Training
Azure Static Web Apps is a modern web app service that offers streamlined full-stack development from source code to global high availability.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Azure Static Web Apps allows you to inject custom code into the head
or body
elements at runtime. These pieces of code are known as snippets.
Snippets give you the flexibility to add code to every page in your site in a single place, all without modifying the core codebase.
Common use cases of snippets include:
Note
Some front-end frameworks may overwrite your snippet code. Test your snippets before applying them to a production environment.
Go to your static web app in the Azure portal.
From the Settings menu, select Configuration.
Select the Snippets tab.
Select the Add button.
Enter the following settings in the Snippets window:
Setting | Value | Comments |
---|---|---|
Location | Select which HTML page element you want your code injected into. | |
Name | Enter a snippet name. | |
Insertion location | Select whether you want to Prepend or Append your code to the selected element. | Prepend means your code appears directly after the open tag of the element. Append means your code appears directly before the close tag of the element. |
Environment | Select the environment(s) you want to target. | If you pick Select environment, then you can choose from different environments to target. |
Enter your code in the text box.
Select OK to close the window.
Select Save to commit your changes.
Training
Learning path
Azure Static Web Apps - Training
Azure Static Web Apps is a modern web app service that offers streamlined full-stack development from source code to global high availability.