The problem:
Recently I was asked to make a completely static site “dynamic” in Rails.
The static site has hundreds of pages, each contains links to others, and my task was to integrate the static site into a rails app.
I tried:
iframe. I put the static site under /public and load the site in an iframe on my regular rails page. It works but it is not an acceptable solution:
- Hundreds of pages in an iframe is bad for SEO. They just cannot be included in my sitemap.xml and indexed by google.
- User cannot access a static page by typing a url in the
browser. - Since Google Analytics code is in the layout, it obviously cannot track the user behavior in the iframe on page.
Am I missing any rails gems/tricks that can handle this situation?
In Rails, what is the best way to handle a large number of static pages?
2
Answers
I trust there is a solution idea can be like , converting all the static pages into CSV or Excel format document and after that getting data in a rails layout .
To not have a large number of static pages.
Seriously, Rails is one of the most robust, dynamic and comprehensive application frameworks in existence, and you want to fill it with static pages?
You’ll be best making a basic
CMS
and populating it withmarkdown
:This will give you the ability to create a simple set of routes:
—
You’d have to populate the database yourself, or if you wanted to create a very simple admin area, I’d strongly recommend using
Devise
:This will give you the ability to create a
CRUD
admin/pages
controller:Then you just have to put your pages into the database, allowing you to call them through your routes. If you want custom routes, use
friendly_id
to create them.