Copied to clipboard

Flag this post as spam?

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


  • wolulcmit 357 posts 693 karma points
    May 20, 2013 @ 09:49
    wolulcmit
    0

    Share posts between different sites in uBlogsy 2.1.1.2

    Hi There,

    have read up on a previous post about how to use uBlogsy in a multi-site environment:
    http://our.umbraco.org/projects/starter-kits/ublogsy/ublogsy-razor-blog/23243-Multi-site-support

    This makes it possible to have multiple blogs across multiple sites, but am just wondering if there is any facility to share posts between sites?

    for example If I have the main blog at Site A, which will show all posts, I then want some of these posts will be tagged with the tag 'Site B'. On Site B I just want to list any posts tagged with 'Site B', similiar to how uBlogsy works when you're on the main uBlogsy node, like this: blog/?tag=Site B

    I guess really I just want to know if its possible to have one uBlogsy post Repository, which you then share posts between sites using the tagging functionality.

    cheers for any help,

    - Tim

     

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    May 20, 2013 @ 11:05
    Anthony Dang
    100

    It's possible.

    You probably already know the id of the "repo" blog node. You can pass that id anywhere you see the the GetPosts() method. Currently the method taks Model.Content.Id.

    So add a category or tag (which ever you choose) to each post. I should just work.

     

     

  • wolulcmit 357 posts 693 karma points
    Jun 06, 2013 @ 08:43
    wolulcmit
    0

    After much head scratching and changing of uBlogsy's cshtml files to reference a static node Id, I eventually found that just changing this in uBlogsyBaseSite.master:

    var BlogNode = Model.NodeById(8601);
    // was using Model.Id before change
    var landing = uBlogsy.BusinessLogic.DataService.Instance.GetLanding(BlogNode.Id);

    was enough to acheive what I wanted to... (no need to alter any of uBlogsy's original cshtml files)

    is this like the one variable to rule them all :)?

    - Tim

  • wolulcmit 357 posts 693 karma points
    Jun 06, 2013 @ 08:46
    wolulcmit
    0

    btw, thanks very much Anthony, uBlogsy is awesome sauce.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jun 11, 2013 @ 14:49
    Anthony Dang
    0

    I never actually considered doing that... GetLanding() is used all over the cshtml files... it's value is cached by the first call to it. I guess doing it your way means that the value is cached at that instance of the call.

    I find that interesting since it is in the base master page. I wonder if this is a reliable way of doing things.


     

  • Amir Khan 1287 posts 2744 karma points
    Dec 16, 2013 @ 23:39
    Amir Khan
    0

    Anthony, could you elaborate a little bit on the ideal setup for this with MVC? Do I even need to set Culture and Hostnames on the blog?

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 02, 2014 @ 01:34
    Anthony Dang
    0

    Hi Amir

    For multi-region sites, you normally set the hostname in the root node of each region. uBlogsy landing can either be a node under the root, or the root itself.

    What Tim was talking about though is something different.

     

  • Amir Khan 1287 posts 2744 karma points
    Jan 03, 2014 @ 20:10
    Amir Khan
    0

    Hi Anthony, I guess my question is more related to how I would set up multiple blogs with a different master template for each blog post so the user didn't have to switch templates when they created a blog post under the second site.

    Does this make sense? I hope I'm not just missing something simple here.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 05, 2014 @ 17:18
    Anthony Dang
    0

    So you want to do something like the following?

    Backoffice editor creates a blog post under region A, which automatically uses template X

    Backoffice editor creates a blog post under region B, which automatically uses template Y

    If that is the case, then it will require some custom code. You'll have to write something for an event hook which will change the template on the creation of the blogpost based on crawling up the tree to find the root node.
  • Amir Khan 1287 posts 2744 karma points
    Jan 05, 2014 @ 18:47
    Amir Khan
    0

    That's exactly the situation I'd like to achieve.

    Is there a way to check for the parent node in razor in a razor view and switch the template inheritance? Basically everything is exactly the same except the inheritance which has the logo, stylsheets, etc.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Jan 06, 2014 @ 15:00
    Anthony Dang
    0

    So if you have a base template, you want to change the template which the post is inherited from?

    That's a no.

    You can define multiple Post templates, which each inherit from different base templates. Then switch the post templates.

    If you're using umbraco 4.10+ then you can do it via router hijacking http://our.umbraco.org/documentation/Reference/Mvc/custom-controllers

    Otherwise, you could do it on the save event in a handler.

    There's no way to do it in razor, and it doesnt make sense to do it there anyway.

Please Sign in or register to post replies

Write your reply to:

Draft