Setting up multi-social feeds on a single multi-site Umbraco using Skybrud
Hi,
Has anyone got any advice on setting up multiple Twitter/Facebook feeds on a single Umbraco install which will have multiple sites/domains?
I'm using Skybrud.Social (https://social.skybrud.dk/) but not 100% sure on recommended set up to ensure unique feeds are possible for each site.
So far I've installed Skybrud and got two different Twitter feeds working on two different domains but am finding the CacheItemPolicy caches the feed details and presents the same Twitter feed on both sites. If I remove the Cache policy it works fine.
The code is largely following the approach laid out in this great guide by Paul Seal, i haven't changed any of the Cache settings yet though commenting them out seems to fix the issue.
@using Skybrud.Social.Twitter
@using Skybrud.Social.Twitter.Objects
@using Skybrud.Social.Umbraco.Twitter.PropertyEditors.OAuth
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = "Master.cshtml";
}
@{
// Get the OAuth information stored in the property
TwitterOAuthData twitter = Model.Content.GetPropertyValue("twitterAuth") as TwitterOAuthData;
// Check whether the OAuth data is valid
if (twitter != null && twitter.IsValid) {
At the moment I've just got the latest SkyBrud.Social NuGet installed (not the Umbraco one) or am I better off using the Umbraco version to help with things like error catching?
Looking at the main SkyBrud API I can't find anything obvious for Twitter username validation / error catching.
Setting up multi-social feeds on a single multi-site Umbraco using Skybrud
Hi,
Has anyone got any advice on setting up multiple Twitter/Facebook feeds on a single Umbraco install which will have multiple sites/domains?
I'm using Skybrud.Social (https://social.skybrud.dk/) but not 100% sure on recommended set up to ensure unique feeds are possible for each site.
So far I've installed Skybrud and got two different Twitter feeds working on two different domains but am finding the CacheItemPolicy caches the feed details and presents the same Twitter feed on both sites. If I remove the Cache policy it works fine.
Any tips appreciated!
Keiron
Hey Keiron,
Can you show how you are setting up the caching?
Nik
Thanks Nik!
The code is largely following the approach laid out in this great guide by Paul Seal, i haven't changed any of the Cache settings yet though commenting them out seems to fix the issue.
https://codeshare.co.uk/blog/how-to-create-a-custom-styled-twitter-feed-for-your-website/
Hey Keiron,
Okay so in order to have different caches for different sites you need to differentiate the caches.
If it was me, I'd do something like this:
1) Change the method definition for GetTweets to this:
Then instead of
cache["tweets"]
andcache.Set("tweets", ...
docache["tweets_" + cacheIdentifier]
andcache.Set("tweets_" + cacheIdentifier, ...
This would turn the caches into unique entries assuming that
cacheIdentifier
is different.So, then when you are calling
GetTweets
pass in something likeModel.Site().GetKey().ToString("n")
to pass in the root node Guid without the -'sDoes that make sense?
Nik
Thanks Nik, that makes sense I'll give it a try.
On another note, I've been looking into the best way to catch errors and validate things like the Twitter username.
Most of the stuff I've found on Our relates to Skybruds Umbraco package https://our.umbraco.com/packages/website-utilities/skybrudsocial-for-umbraco-7/
e.g. https://our.umbraco.com/packages/website-utilities/skybrudsocial-for-umbraco-7/general-discussion/74840-setting-up-a-twitter-feed
At the moment I've just got the latest SkyBrud.Social NuGet installed (not the Umbraco one) or am I better off using the Umbraco version to help with things like error catching?
Looking at the main SkyBrud API I can't find anything obvious for Twitter username validation / error catching.
Got this working, thanks for your help Nik!
Now fighting with catching authentication errors with caching enabled, it's almost there :)
is working on a reply...