For each subdomain/branch custom Snippet injection

For each subdomain/branch custom Snippet injection

for example: different Snippet injection too

Hey @Anonymus2020,
You can kinda do this now with something like:

function doThingA(){
  document.querySelector("link[rel*='icon']").href = "/pathToSubdomainAFavicon/favicon.ico";

function doThingB(){
  document.querySelector("link[rel*='icon']").href = "/pathToSubdomainBFavicon/favicon.ico";

// if you wanted, you could also set the path in an env variable and access it like this:
// const b = {{ PATH_TO_SUBDOMAIN_B_FAVICON }}
// console.log(b)

if (window.location.href.indexOf('subdomainA') > -1) {
} else if (window.location.href.indexOf('subdomainB') > -1)
} else {

Would that work for you?

i replace SUBDOMAIN2_VAR to Name of branch/subdomain?

Hey there,
No, it’s just an example in case you want to use an environment variable in your snippet. Can you say more about what you’re trying to do? Maybe I can advise better and adapt the snippet I shared.

for example:

different favicons

Ah, gotcha! I updated the snippet with that in mind. It will depend on your file structure, so you’ll have to tweak it to suit your exact needs.

1 Like