Running BlogBox as main application

I wanted to run BlogBox as the main application on a subdomain, so blog.foo.com instead of foo.com/blog

Since it’s built as a module, I just made some modifications to my BlogBox BBHelper file for how it creates the links to categories, posts, etc

Then I did a URL rewrite on my webserver to make all requests go to to my blog entrypoint (/blog)

So hitting a url such as foo.com/category/software is really hitting foo.com/blog/category/software

Anyway, this feels like a little bit of an end around, so I was hoping maybe you guys had a more clever solution (or a more simple / obvious solution, perhaps I just don’t know all of the ins and outs of modules well enough yet).

I tried using just / as the entrypoint and also an empty string as well, both caused issues with various parts of Blogbox.

I also tried setting my default event to the BB index event, which actually worked fine, blog.foo.com displayed the blog as the main page, but the generated links went to blog.foo.com/blog/category/software instead of blog.foo.com/category/software

This is what caused me to modify the link generation and map all urls to blog/

Anyway, perhaps we should have a packaged standalone BlogBox application template that runs BB as the main application.

Maybe I missed something obvious, or I just haven’t worked with modules quite enough as I need to like I said earlier, but for now I have it working just the way I want it to, but it feels a bit hackish on my part.

Hmm interesting. Let me explore it

Here are the steps to run as main application.

1. Change the default event to: blogbox-ui:blog

2. Open the parent app routes.cfm and add:

AddModuleRoutes(pattern="regex:.*",module="blogbox-ui");

This is so all SES traffic is redirected to the module instead.

3. Open the blogbox-ui ModuleConfig.Cfc and make the entry point to be an empty string.

That's it.

See, I knew you would have a simple solution! Thanks! The empty string was throwing an error before, but that’s because I didn’t have the route. I learned a lot messing around with it though :slight_smile:

Anyway, I will attempt this and report back any issues, hopefully there are none.

I’m finally ready to put up our corporate blog and my personal one also, so I’ll be using BlogBox for both I believe.

Ok, I tried that, but had two hangups.

1.) The generated links to categories become:
http://blog.foo.com//category/software-engineering

That’s not a big deal, I can just change the helper to check for an empty string and remove the slash. That aside, visiting the links as they should be (just http://blog.foo.com/category/software-engineering) shows:

Application Execution Exception
Error Type: HandlerService.EventHandlerNotRegisteredException : [N/A]
Error Messages: The event: category.software-engineering is not valid registered event.

Visiting: http://blog.foo.com/blog/category/software-engineering works just fine, so I could rewrite / to blog/ through Apache or nginx like I was doing before to solve the problem.

Is this the behavior you see? I don’t use index.cfm at all in my urls.

Ok,

I updated the BBHelper for link generation now.

Also, I updated it so you don't need to modify the parent application
or anything. So here are the new steps:

1) Change this.entryPoint = "" in the ModuleConfig.cfc of blogbox-ui
2) Start your app!

That's it. The module onLoad() interceptor detects if the entrypoint
is empty and if it is, it will change the main's app default event and
also add the appropriate routing for it. Much easier.

Excellent!!!