How to integrate a CMS into an existing Rails site
One of the challenges I see over and over again is a company with an existing website wants to integrate a Content Management System. Are there standard approaches/techniques for doing this that keep th开发者_如何学编程e existing website but allow certain pages or content snippets to be driven by the CMS?
For example let's say you have a Rails website that currently has the about us, jobs, and press-release pages hardcoded as well as a newsticker on the homepage. You want to move those pages into a CMS (such as Radiant) while re-using the current site layout. In other words if I make a change to the site header in app/views/layouts/application.html.haml it should then also be reflected in the CMS managed pages. How do you go about effectively letting a CMS like Radiant manage certain pages on your existing website?
I have only worked with Radiant where it manages the whole site. We have also set up a blog at a particular URL (running Wordpress) by configuring the web server to pass certain requests to Wordpress and the rest to Radiant. If you have custom functionality you want to use within Radiant, it has an "Extensions" architecture. If you want to move your pages into Radiant and share layout bits, you can define a layout with your layout markup, then each "Page" you create in Radiant requires that you specify a layout for it.
If you are trying to share a Rails application layout file and have Radiant know about it, I'm not sure that is possible. Typically a CMS is deployed so non-programmers can edit content on public-facing web pages, in my experience these pages often serve the marketing function of an application that may be powered by Rails. If the public marketing web page also happens to have the same markup as the application, I'd copy and paste the HTML into Radiant. Typically these public marketing pages have a specific design and are not intended to be as flexible with the content they display as Rails application layout (with arbitrary controllers etc.).
To get started with your public pages, you can either create static HTML pages in your Rails app public directory, or create a controller and views (in its corresponding directory) that can share a layout (about, contact, etc.).
精彩评论