Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How to link to start page?

Vote:
 

I have a logo in my root layout that needs to link to the start page with the correct language.

<a  href="/">
      <img class="logo" src="/static/img/logo.png" alt="Company name" />
    </a>

How do I set the href the correct way?

#78047
Dec 02, 2013 21:03
Vote:
 
ServiceLocator.Current.GetInstance<IContentLoader>().Get<StartPage>(PageReference.StartPage).LinkUrl;

Something like this (from memory).

Frederik 

#78050
Dec 02, 2013 22:20
Vote:
 

If you want to force the language part (e.g. you're visiting the website without any language in the url):

protected string StartPageUrl
{
    get
    {
        return "/" + ServiceLocator.Current.GetInstance<ILanguageBranchRepository>().Load(ContentLanguage.PreferredCulture).CurrentUrlSegment + "/";
    }
}

    

#78058
Dec 03, 2013 0:35
Vote:
 

Try this:

<EPiServer:Property PageLink="<%# PageReference.StartPage %>" PropertyName="PageLink" runat="server">

    

/HaBui

 

#78065
Edited, Dec 03, 2013 7:42
Vote:
 
#78533
Edited, Dec 03, 2013 10:38
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.