mercredi 31 décembre 2014

Double replacement for site collection replacement token in master page?



I am setting up custom branding for a site, using a custom master page, and linking to custom css, image and script files all hosted in the Style Library on the root web of the site collection.


As suggested in this answer, I am using the replacement token ../.. to refer to the site collection. So, for example, some of my links look like this:



<link href="../../Style Library/custom/css/custom_v2.css" rel="stylesheet" type="text/css"/>
<asp:Image ImageUrl="../../Style Library/custom/img/logo3.png" runat="server" />


This works fine for the home page of the site, and for any main list view for any of the lists or libraries on the site. However, if I go to a "system" page, like Site Contents or Site Settings, everything gets broken, and I can see that my links have turned into this:



<link href="../../sites/mysite/Style Library/custom/css/custom_v2.css" rel="stylesheet" type="text/css"/>
<asp:Image ImageUrl="../../sites/mysite/Style Library/custom/img/logo3.png" runat="server" />


So it seems as though the URL replacement is happening twice in those cases. Why is this happening, and is there anything I can do about it?


(The same custom master page is specified for both SPWeb.MasterUrl and SPWeb.CustomMasterUrl.)








0 commentaires:

Enregistrer un commentaire