Custom home page routing


(bunjee) #1

Continuing the discussion from Custom home page to discourse:

Dear Discoursers,

I felt adventurous after following @eviltrout ember tutorial: Adding to Discourse using Ember.js Part 1: Routing and Templates - Evil Trout's Blog.

In the previous discussion I made a new home page :smiley:. I thought routing to my new home would be fairly easy.

I tweaked routes / application_routes.js and changed discovery default route to my sexy home.
This happens to break discovery routing.

So I added that in routes / application.js.es6:

var ApplicationRoute = Em.Route.extend(
{     
    beforeModel: function()
    {
        if (window.location.pathname == "/")
        {
            this.transitionTo("home");
        }
    }
}

This works okay without breaking discovery routing and login redirection.

My question is simple: is this an ugly hack ?

Is there a better way ?

P34CE.


(Robin Ward) #2

Our current design really wants the homepage to be discovery based – maybe if you explained what you were trying to do we could help?


(bunjee) #3

An entirely custom home page for my discourse community.


(Robin Ward) #4

How do you see it fitting into the layout of the site though? Do you want to replace everything but the header?

Would it be a discovery based template, where it shows up below the various “Latest, New, etc” pills?


(bunjee) #5

Yeah I’m keeping the header. I’m just adding links pointing to my pages.

A simple page with a few highlight boxes followed by a simple topic feed.

I’m doing a community site. Instead of coupling wordpress / discourse I decided to go discourse all the way.

That’s why I’m happily hacking my way through ruby and ember :smiley: .


#6

Did you just go for your solution or is there any recommended way of adding a custom home page?