|
|
Hi,
I'd like to use a token PortalSettings.ActiveTab.FullUrl with a variable in the
og:url meta property. How do I do this?
I now have something like this, but it doesnt work (obviously):
<fortyfingers:STYLEHELPER ID="STYLEHELPER3" AddToHead='<meta property="og:url" content="<%= PortalSettings.ActiveTab.FullUrl %>?r=s" />' runat="server" />
Thanks,
Keston
|
|
Coordinator
May 9, 2012 at 2:41 PM
Edited May 9, 2012 at 2:45 PM
|
Ok, I might add token repalce in the future, but for now you can use this I think:
<fortyfingers:STYLEHELPER ID="STYLEHELPER3" AddToHead='<meta property="og:url" content='<%#PortalSettings.ActiveTab.FullUrl & "?r=s" %>' />' runat="server" />
Note I use <%#...%> not <%=...%>, which means the value is injected on databind, before the control is loaded.
<%=...%> is injected after and thus fails.
Disadvantage is that everything you inject has to be inside the <%#...%>
You cannot use:
content="<%# PortalSettings.ActiveTab.FullUrl %>?r=s"
HTH Timo
|
|
May 9, 2012 at 4:07 PM
Edited May 9, 2012 at 4:14 PM
|
Tnx
<fortyfingers:STYLEHELPER ID="STYLEHELPER3" AddToHead='<meta property="og:url" content='<%#PortalSettings.ActiveTab.FullUrl & "?r=s" %>' />' runat="server" />
doesn't get injected in the header properly.
<fortyfingers:STYLEHELPER ID="STYLEHELPER3" AddToHead='<meta property="og:url" content="<%#PortalSettings.ActiveTab.FullUrl & "?r=s" %>" />' runat="server" />
does get in\jected in the header only because of the double quote; the meta content stays like this:
<%#PortalSettings.ActiveTab.FullUrl & "?r=s
|
|
Coordinator
May 10, 2012 at 5:17 PM
Edited May 10, 2012 at 5:18 PM
|
Ok, I made a mistake.
You can do it the way I posted with some changes, but it's easier (and more readable) to add a small server side function.
Add this to your ascx skin (on top):
<script runat="server">
Private Function GetMeta() as String
Return String.Format("<meta property=""og:url"" content=""{0}?r=s"" />" , PortalSettings.ActiveTab.FullUrl)
End function
</script>
<fortyfingers:STYLEHELPER AddToHead='<%#GetMeta()%>' runat="server" />
Hope it does work now.
Timo
|
|