Copied to clipboard

Flag this post as spam?

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


  • Johan 4 posts 24 karma points
    Jan 09, 2015 @ 03:58
    Johan
    0

    Setting up multi-section website sharing the same page sets

    Hi all,

    First time on the forum, please let me know if I am not posting this in the right category.

    I am hoping I can get some ideas on setting up the correct CMS structure.

    I want to build a relatively small site with simple content, like so:

    • www.website.com/about-me
    • www.website.com/about-you

    I know I can simply set up the tree like so:

    • Home
    • --- About Me
    • --- About You

    However, I want to be able to customise the colour and logo by introducing identifier in the URL, like this:

    • www.website.com/spring-theme/about-me
    • www.website.com/spring-theme/about-you
    • www.website.com/summer-theme/about-me
    • www.website.com/summer-theme/about-you

    I can set up the tree like so:

    • Home
    • --- Spring Theme
    • -------- About Me
    • -------- About You
    • --- Summer Theme
    • -------- About Me
    • -------- About You

    However, this is not very efficient, as the core content for /about-me and /about-you are always the same.

    What would be the best approach to achieve this?

    Thank you,

    Johan.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 09, 2015 @ 05:40
    Jan Skovgaard
    1

    Hi Johan and welcome to our :)

    So I guess you want to be able to display your content using different themes depending on the time of the year. If you plan to use the same HTML structure at all times it should be fairly easy. You don't want to keep multiple site sections where the theme is a part of the url since it's not good for SEO if you have multiple url's leading to the same content or you change the url's every 6 months...that will confuse the search engines and you need to setup 301 redirects etc. - I think it's the wrong path to go down at.

    The way I see it what you need to do is to make sure you can change the path to the CSS files.

    You can choose to do it manually evert time when you want to change the theme, or you could make a theme setting on your "Home" node where you setup a dropdown property editor in the "Developer -> Datatypes" where you add the names of your different themes (Could easily be more than two). Then add it to the "Home" document type in the "Settings" section.

    Now you can choose and save the name of the theme.

    You then need to create a macro that looks on the selected value and based on that decides, which stylesheet path should be used in your <link rel="stylesheet"> tag.

    Does this make sense?

    /Jan

  • Johan 4 posts 24 karma points
    Jan 09, 2015 @ 06:49
    Johan
    0

    Hi Jan,

    Thank you.
    I am genuinely enjoying my time exploring Umbraco, and this is a great community.

    While what you suggested makes a lot of sense, I clearly presented a bad example, so I'll start over.

    I would like to create a small site to cater for different group of people.
    Each group have their own skin and logo, but the exact same content, like so:

    • www.website.com/guitar/
    • www.website.com/guitar/meet-ups
    • www.website.com/guitar/music-events
    • www.website.com/violin/
    • www.website.com/violin/meet-ups
    • www.website.com/violin/music-events
    Both /guitar/meet-ups and /violin/meet-ups presents exactly the same content, only different page skin.
    I know I can set this by simply using URL querystring:
    • www.website.com/meet-ups/?group=guitar
    • www.website.com/meet-ups/?group=violin
    The page template can then serves the appropriate CSS style according to [group] value.
    I am just looking for an alternative to incorporate the [group] parameter as part of the URL.
    I was thinking something along the lines of the following tree structure:
    • Home
    • --- Meet Ups
    • --- Music Events
    • Groups
    • --- Guitar
    • --- Violin
    • --- Keyboard
    Then somehow combine both?
    I hope this makes more sense.
    Thank you,
    Johan.
  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 09, 2015 @ 07:12
    Jan Skovgaard
    0

    Hi Johan

    Happy to hear that you enjoy the community - Now you're a part of it yourself. Feels good, right? :)

    When you say groups...is it then if people are logged in to the site using the "Members" section of Umbraco? If so it should be possible to check what group the current member is a part of and then serve the proper CSS file to them based on that knowledge.

    That way you don't need to rely on the querystring either.

    Looking forward to hearing from you.

    /Jan

  • Johan 4 posts 24 karma points
    Jan 09, 2015 @ 07:24
    Johan
    0

    Hi Jan,

    It does. Awesome indeed.

    I will not be using the Members login feature by Umbraco, Jan.

    I want to make it as simple as possible and my target audience / public with URL can access it at anytime.

    Thanks, Johan.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 09, 2015 @ 07:32
    Jan Skovgaard
    0

    Hi Johan

    Ok, but if you don't control what you're serving to the different targets using Umbraco members how do you then plan to keep track on it?

    You'll of course be able to persist the theme using a cookie or localstorage so users will see their preferred theme each time they visit the website - But you won't be able to know their preference beforehand.

    But maybe it's just early in the morning and I'm misreading your post - Could it be that you just want a different theme pr. site section? So the guitar section looks different from the violin section?

    In that case it should be a matter of making the same datatype as I suggested in my initial post and then just choose it on the parent nodes for the sections. So on the "Guitar" node you select the "Guitar" theme, which is then used on this node and the child-nodes and on the "Violin" page you choose the "Violin" theme, which is then displayed on the "Violin" page and it's children.

    Hope this is what you have in mind? :)

    /Jan

  • shinsuke nakayama 109 posts 250 karma points
    Jan 09, 2015 @ 07:55
    shinsuke nakayama
    1

    Hi guys,

    Just a quick suggestion, If its same content, then can it the content be part of the template and set the theme at "www.website.com/violin/" and "www.website.com/Guiter/"?

    so page structure look like this

    Home
     - Violin (Set theme here)
        - Meetups
        - Events
     - Guiter (set theme here)
        - Meetups
        - Events
    

    and the content can be hard coded in the template?

    or you can create partial view or macro

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 09, 2015 @ 07:57
    Jan Skovgaard
    0

    Yup, that's exactly what I meant in my previous response :) But thanks for making it visually clearer #h5yr

    /Jan

  • shinsuke nakayama 109 posts 250 karma points
    Jan 09, 2015 @ 08:10
    shinsuke nakayama
    0

    arhh ops, sorry Jan :) i wanted emphasis more in hard coding content in template / partial view. Tho i strongly don't encourage any hard coding.

    Also Welcome Johan, good to see another developer from Australia :)

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 09, 2015 @ 08:13
    Jan Skovgaard
    0

    @shinuske - No need to be sorry - Your answer is clearer since it visually is quicker to grasp the concept than my long writing ;-)

    /Jan

  • Johan 4 posts 24 karma points
    Jan 12, 2015 @ 07:13
    Johan
    0

    @Jan / shinsuke : Thank you for the response, I apologise for the very late reply.

    Tree structure suggested by both of you does make sense.
    However, I am trying to find solution which does not require the content editor to add another same tens of pages when a new [group] is introduced.
    Every instrument group has the same number of pages, with exactly the same content. 

    Example:

    Home
      - Violin
        - Page A
        - Page B
        - ... (another 23 pages)
     - Guitar
       - Page A
       - Page B
       - ... (another 23 pages)
     - Keyboard (new group)
       - Page A
       - Page B
       - ... (another 23 pages)

    After researching for awhile, I found another alternative which is a bit intriguing.
    Basically, I can use this tree structure:

    Home
      - Page A
      - Page B
      - ... (another 23 pages)

    Incorporate URL redirection rules like so:
      - IF user requests www.website.com/violin/meet-ups/, serve the content from www.website.com/meet-ups?group=violin.
      - IF user requests www.website.com/guitar/meet-ups/, serve the content from www.website.com/meet-ups?group=guitar.

    The page template will check the querystring and render the correct layout as appropriate based on the group parameter.
    The user still sees www.website.com/violin/meet-ups/ format in their address bar.

    Can I get your opinion on this, please?

    Thank you,
    Johan. 

  • shinsuke nakayama 109 posts 250 karma points
    Jan 13, 2015 @ 05:06
    shinsuke nakayama
    0

    Hi Johan,

    hmm weird, i can't see your post, i can only see via email. or change the url manually.

    If you don't want to create page by page, right now i can think of 2 ways:

    1. copy the group folder and its child pages, and paste it. so you don't have to keep creating new one.
    2. Use Custom MVC Routing (Route Hijacking)

    With Option 2, you have to create your own routing rule.

    I just created prototype base on your scenario and it seems to work.

    the reference i used to build my prototype can be found here ref: http://shazwazza.com/post/Custom-MVC-routing-in-Umbraco

    I have created a file call "app_start/RouteConfig.cs"

    namespace Umbraco.Extensions.EventHandlers
        {
            public class MyStartupHandler : IApplicationEventHandler
            {
            public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
            }
    
            public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
            }
    
            public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                //Create a custom route
                RouteTable.Routes.MapRoute(
                    "test",
                    "products/{id}/{action}/{controller}",
                    new
                    {
                        controller = "Test",
                        action = "Test",
                        id = UrlParameter.Optional
                    });           
            }
        }
    }
    

    In the routing rule, i setup

    "products/{id}/{action}/{controller}"
    

    in this url structure, i put it under "products" url because the system needs to distinguish between umbraco routing rule vs your own routing rule. so anything under "http://url.com/products/" will be using your routing rule. Else it will be using Umbraco Rule.

    Then i have "{id}/{action}/{controller}" instead of {controller}/{action}/{id} because i want to have following url structure

    and in your TestController it will look something like this:

    public class TestController : PluginController
        {
            public TestController(UmbracoContext umbracoContext) : base(umbracoContext)
            {
            }
    
            public TestController() : this(UmbracoContext.Current)
            {
            }
    
            public ActionResult Meeting()
            {
                return View("Meetings");
            }
    
            public ActionResult Events()
            {
                return View("Events");
            }
    
            public ActionResult Test()
            {
                return View("Events");
            }
    
        }
    

    Then you can have following URL structure without creating many trees / pages

    I really don't like how i had to change the routing rule to "{id}/{action}/{controller" but thats the only way i can think of without creating many controllers for different groups.

    Let me know if you found better solution, i'm curiouse as well :)

    cheers

    Shinsuke

Please Sign in or register to post replies

Write your reply to:

Draft