XF 1.5 JavaScript in Templates to modify variable?


Active member
I'm trying to change og:image in RM to use the Resource Icon, so FB previews display the icon instead of the forum logo on RM. I've got that working fully by modifying the open_graph_meta template:

    <xen:if is="{$resource}">
    <xen:if is="{xen:helper resourceiconurl, $resource}"><meta property="og:image" content="{xen:helper resourceiconurl, $resource}" /></xen:if>
    <xen:else />
    <meta property="og:image" content="{xen:helper fullurl, @ogLogoPath, 1}" />

Now I have one last issue. The Resource Icon URL has a query string after it, which Facebook doesn't like. We don't need cache-busting on the resource icon anyway (we never change them), so I'm trying to find a way to get the URL with query string stripped out.

I know how to do it in JavaScript, but that's client side, so it's probably not going to even work. Can you think of any ways that I can get the Resource Icon URL without query string in a template? Thanks!
Last edited:
This question was dumb in so many ways, it was even dumb because it wasn't needed! Facebook doesn't care about query strings, they cared about me providing a URL with no domain (like data/icons/0/123.jpg instead of http://domain.com/data/icons/0/123.jpg).

Dumb case solved... :) If anyone else happens to be using a similar setup, setting og:width and og:height helps too.
Top Bottom