Skip to content

ClarkSource/comfortable_mexican_loveseat

Repository files navigation

ComfortableMexicanLoveseat

The Comfortable Mexican Loveseat is an expansion pack to the Comfortable Mexican Sofa. It currently contains minor modifications to the snippet.rb and base_controller.rb files, improved sitemap functionality, and SEO-enhancing modifications.

The Loveseat references a fixed version of the CMS (currently 1.12.8) and latest releases are pulled in occasionally.

Installation

The Loveseat is currently installed through the foxinator-generator

Features

NOTE: When you are adding new models and/or controllers and links are not showing up, do not forget to click the “Sync” button!

Comment Mailer

To configure the comment mailer, add this line to config/initializers/comfortable_mexican_sofa.rb

config.from_email = an@example.com

Simplified Fixture Import/Export

When you want to import fixtures you can now use the following commands:

rake cms:import # imports from all folders and automatically creates matching sites if they don't exist
rake cms:import FROM=somewhere # automatically imports to somewhere
rake cms:import FROM=somewhere TO=something LOCALE=de #lets you set the locale for the site

rake cms:export
rake cms:export FROM=somewhere
rake cms:export FROM=somewhere TO=something LOCALE=de

To export a zipped folder of all fixtures (useful for syncing fixtures from different servers) you can run:

rake cms:zip

To get this working on cloud66, add these files to your .cloud66 folder:

# save this as deploy_hooks.yml
staging:
  after_rails:
    - source: /.cloud66/permissions.sh
      destination: /tmp/permissions.sh
      target: rails
      execute: true
      sudo: true
production:
  after_rails:
    - source: /.cloud66/permissions.sh
      destination: /tmp/permissions.sh
      target: rails
      execute: true
      sudo: true

# save this file as permissions.sh
chown nginx:app_writers $STACK_PATH/public
chmod 0775 -R $STACK_PATH/public  

# change the group of the public folder from nginx to app_writers
sudo chown :app_writers public

#change the permissions on the folder to 775
sudo chmod 775 public

SEO Features

Custom Sitemaps

Building on the Sofa’s sitemap functionality, the Loveseat lets you add Rails model show pages and custom routes to the sitemap.

To use it, please copy and customize the demo initializer located in templates/comfortable_mexican_loveseat.rb and in your routes.rb file make sure you have this line:

comfy_route :cms, :path => '/', :sitemap => true

Then replace your robots.txt file with the one in the templates folder.

URL Redirection

By default when using the Loveseat, all trailing slash URLs (‘myapp.com/example/’) are redirected to a non-trailing slash URL.

Page Meta Tags

By default when you create an application, it comes with meta description; page title; index; canonical link; and Social Media (Google+, Facebook, and Twitter) fields that can be filled in on a per-page basis. To display these tags, add this to your application.html.erb:

<title><%= comfy_page_title %></title>
<%= comfy_seo_tags %>

Tags are set on a per-page basis, except for canonical links, which default to the page URL if none has been entered manually.

File Upload helper text

The Loveseat provides some helpful hints to admins when they’re uploading images (choose an SEO-friendly name, add an alt-tag), which you can add to your locale files.

images_need_seo_friendly_names
files_alt_tag

Styled login page

There is a more styled version of the CMS login page in the templates/devise folder.

Changelog

  • 01/12/2016 - Updated cms_block_content() to be faster. You can still use the old code (which can have slightly different functionality) by passing in an overwrite flag. See the cms_helper.rb for source code. Improved the speed with which SEO tags get loaded in the header.