Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Keiron 4 posts 76 karma points c-trib
    Jul 02, 2019 @ 15:02
    Keiron
    0

    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

  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Jul 02, 2019 @ 15:26
    Nik
    0

    Hey Keiron,

    Can you show how you are setting up the caching?

    Nik

  • Keiron 4 posts 76 karma points c-trib
    Jul 02, 2019 @ 15:52
    Keiron
    0

    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/

  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Jul 02, 2019 @ 20:20
    Nik
    1

    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:

    public static IEnumerable<TwitterStatusMessage> GetTweets(string consumerKey, string consumerSecret, string twitterUserName, int cacheTimeInMinutes, string cacheIdentifier)
    

    Then instead of cache["tweets"] and cache.Set("tweets", ... do cache["tweets_" + cacheIdentifier] and cache.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 like Model.Site().GetKey().ToString("n") to pass in the root node Guid without the -'s

    Does that make sense?

    Nik

  • Keiron 4 posts 76 karma points c-trib
    Jul 03, 2019 @ 08:08
    Keiron
    0

    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

    @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.

  • Keiron 4 posts 76 karma points c-trib
    Jul 03, 2019 @ 15:59
    Keiron
    1

    Got this working, thanks for your help Nik!

    Now fighting with catching authentication errors with caching enabled, it's almost there :)

Please Sign in or register to post replies

Write your reply to:

Draft