Hello, I'm trying to create my first bootstrap based MVC layout in Sitefinity (10.2). I'd like to include a juicer twitter feed (https://www.juicer.io), but the script required is causing editing the page on the back-end to fail. Is there a way, in my template, to not include the javascript file if I'm in backend edit mode?
This is their embed code:
<script src="assets.juicer.io/embed.js" type="text/javascript"></script>
<link href="assets.juicer.io/embed.css" media="all" rel="stylesheet" type="text/css" />
<ul class="juicer-feed" data-feed-id="ufcumortgageservices"></ul>
Here are the error messages I get when the their javascript is included in the template:
Uncaught TypeError: this.get_variationsListView(...).kendoListView is not a function
at Telerik.Sitefinity.ABTesting.Web.UI.EndABTestDialog._initVariationsListView (Telerik.Web.UI.WebResource.axd?...)
at Telerik.Sitefinity.ABTesting.Web.UI.EndABTestDialog.endUpdate (ScriptResource.axd?d=RKOAtpU6MawFuLDEHL6kY48hoDRdgDiG23QTy48JZkkAJdZI3bh3xVJRmljZSFtyUgaEXzzLFTTLLlOEREicUJmEIBS_OmVsMHoD4NxVpj7-jUAYbBNndxCY4mYxWkMsuwsmpZISwZFk8YwbHW885E8dvn--Wr63RXlQHGi7X3h49g7zS-NH85tkooxOU8lT0&t=57f96f83:1)
at Function.Sys.Component._register (ScriptResource.axd?d=RKOAtpU6MawFuLDEHL6kY48hoDRdgDiG23QTy48JZkkAJdZI3bh3xVJRmljZSFtyUgaEXzzLFTTLLlOEREicUJmEIBS_OmVsMHoD4NxVpj7-jUAYbBNndxCY4mYxWkMsuwsmpZISwZFk8YwbHW885E8dvn--Wr63RXlQHGi7X3h49g7zS-NH85tkooxOU8lT0&t=57f96f83:1)
at Sys.Component.create (ScriptResource.axd?d=RKOAtpU6MawFuLDEHL6kY48hoDRdgDiG23QTy48JZkkAJdZI3bh3xVJRmljZSFtyUgaEXzzLFTTLLlOEREicUJmEIBS_OmVsMHoD4NxVpj7-jUAYbBNndxCY4mYxWkMsuwsmpZISwZFk8YwbHW885E8dvn--Wr63RXlQHGi7X3h49g7zS-NH85tkooxOU8lT0&t=57f96f83:1)
at Array.<anonymous> (Edit:3000)
at ScriptResource.axd?d=RKOAtpU6MawFuLDEHL6kY48hoDRdgDiG23QTy48JZkkAJdZI3bh3xVJRmljZSFtyUgaEXzzLFTTLLlOEREicUJmEIBS_OmVsMHoD4NxVpj7-jUAYbBNndxCY4mYxWkMsuwsmpZISwZFk8YwbHW885E8dvn--Wr63RXlQHGi7X3h49g7zS-NH85tkooxOU8lT0&t=57f96f83:1
at Function.Sys.Observer.raiseEvent (ScriptResource.axd?d=RKOAtpU6MawFuLDEHL6kY48hoDRdgDiG23QTy48JZkkAJdZI3bh3xVJRmljZSFtyUgaEXzzLFTTLLlOEREicUJmEIBS_OmVsMHoD4NxVpj7-jUAYbBNndxCY4mYxWkMsuwsmpZISwZFk8YwbHW885E8dvn--Wr63RXlQHGi7X3h49g7zS-NH85tkooxOU8lT0&t=57f96f83:1)
at Sys._Application.Sys.Application._raiseInit (ScriptResource.axd?d=FgIOGdfqFskQuyK9Pq2GzvEdeq7WZfhEV_gNobKyofsJwH0J-6z8QNDmlK3IJ9VkqzmjHIFZh3wJ92dD-iFeyXex_5oCo99JnnOk-feVFEW0bnuRJEqIJqq8VOiSTsW743c61mcYIqJn0bSKYJH5jnj0EGfRkRNppvwBCeRhO9YiysAihiKeP1HXrsh1MP_u0&t=57f96f83:1)
at Sys._Application._doInitialize (ScriptResource.axd?d=RKOAtpU6MawFuLDEHL6kY48hoDRdgDiG23QTy48JZkkAJdZI3bh3xVJRmljZSFtyUgaEXzzLFTTLLlOEREicUJmEIBS_OmVsMHoD4NxVpj7-jUAYbBNndxCY4mYxWkMsuwsmpZISwZFk8YwbHW885E8dvn--Wr63RXlQHGi7X3h49g7zS-NH85tkooxOU8lT0&t=57f96f83:1)
Uncaught TypeError: jOuterDiv.kendoWindow is not a function
at Telerik.Sitefinity.ABTesting.Web.UI.EndABTestDialog._documentReadyHandler (Telerik.Web.UI.WebResource.axd?...)
at HTMLDocument.<anonymous> (ScriptResource.axd?d=RKOAtpU6MawFuLDEHL6kY48hoDRdgDiG23QTy48JZkkAJdZI3bh3xVJRmljZSFtyUgaEXzzLFTTLLlOEREicUJmEIBS_OmVsMHoD4NxVpj7-jUAYbBNndxCY4mYxWkMsuwsmpZISwZFk8YwbHW885E8dvn--Wr63RXlQHGi7X3h49g7zS-NH85tkooxOU8lT0&t=57f96f83:1)
at c (embed.js:2)
at Object.fireWith [as resolveWith] (embed.js:2)
at Function.ready (embed.js:2)
at HTMLDocument.a (embed.js:1)
Telerik.Web.UI.WebResource.axd?...)
at c (embed.js:2)
at Object.fireWith [as resolveWith] (embed.js:2)
at Function.ready (embed.js:2)
at HTMLDocument.a (embed.js:1)
Hello bwilson,
I am relatively new to Sitefinity development also, but I think I can help you out here.
In your razor html template, wrap the script code you wish to include with something like this:
@if (!SystemManager.IsDesignMode)
{
}
This will only render the html inside of this conditional statement when the page is not in design mode. There are other "Is[ ]Mode" types you may also want to include, such as IsInlineEditingMode, and IsPreviewMode. You will have to decide on that for yourself.
Side note: This will require @using Telerik.Sitefinity.Services; at the top of your template code.
Hope this helps.
Thank you very much - this got me to where I needed to be! I kept trying to search, but guess I wasn't hitting on the right search terms. I appreciate the help.