2

I'm trying to make a Site Template so that we can easily create subsites.

We are using promoted links on the home page and would like them to be relative to their location instead of static links.

eg. /subsite1/SitePages/xyz.aspx or /subsite2/SitePages/xyz.aspx

They cannot all point to the same page. They need to point to their respective subsite page.

Anyone knows a work around?

I've heard of a jQuery hack, but I'm hoping we can avoid that.

1

I ended up just using jQuery to override the redirect.

$(document).ready(function(){
    $('li[title="Help & FAQ"]').parent().parent().parent().attr("clickaction", "PreventDefaultNavigation(); STSNavigate('helpfaq.aspx'); return false;"); 
    $('li[title="Feedback"]').parent().parent().parent().attr("clickaction", "PreventDefaultNavigation(); STSNavigate('feedback.aspx'); return false;");
});

It doesn't look very nice but it works. The way I've done it allows me to only override the two specific links across all sites in the collection.

1
  • I am similar boat but in my case I need that the standard Hyperlink in SP2016 to also accep URL starting with cdb:// whereas at moment, it will not accept any URL unless it starts with https:// :( how can I use yor code for that?
    – Bucki
    Aug 16 at 12:14
0

I think you may need to write that in an event receiver. You could create an event receiver that whenever a new site has been created, to create any of the links relative to the web, such as:

SPList targetList = targetWeb.Lists["Promoted Links"];
SPListItemCollection items = targetList.Items;
SPListItem item = items.Add();
item["Title"] = "NewLink";
item["Link Location"] = properties.Web.Url + "/"
item["Background Image Location"] = properties.Web.Url + "/_layouts/images/customimage.png";
item.Update();
1
  • With my limited knowledge I wouldn't be able to implement that. Also my SP site is not a VS package thus I cannot change the code via the SP UI.
    – Michael
    Oct 16 '15 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.