0
votes

i've create a custom master page , and i wanna apply it for 2 different sites, with a little change : i wanna only change the banner image for each site , so i'm trying to link it directly from each site assets without making 2 different master pages : this is my custom master page code :

<div id="banner"><img src="what should i put here?" /></div>

2)https://mydomaine.sharepoint.com/sites/sitecollection/site2/_catalogs/masterpage/images/banner2.png

<img src="what should i put here?" />
1

1 Answers

0
votes

I suggest you to save image with same name in style library or image library of each site , then query using current site context And assign image src with JavaScript or jquery

    clientContext = SP.ClientContext.get_current();
    website = clientContext.get_web();
    var list = website.get_lists().getByTitle("library name");
    CamlQuery = "".....
    var items = list.getItems(<CAML Query>);


    onsuccess(){

    var imgsrc = "<get your image url>"
    $('#banner img').attr('src',imgsrc);
    }

   onfailure(){
   }