Skip to content

Instantly share code, notes, and snippets.

@ehoch
Last active December 11, 2015 17:49

Revisions

  1. ehoch revised this gist Jan 25, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Canonical URLS.md
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    [Alarm Grid](https://www.alarmgrid.com) will show you how to create canonical urls in Spree Commerce.
    [Alarm Grid](https://www.alarmgrid.com) will show you how to create canonical urls in Spree Commerce. This is only an example for products show. You must implement EVERYWHERE.
  2. ehoch revised this gist Jan 25, 2013. 3 changed files with 16 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions _canonical_url.html.erb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    - if @canonical_url
    = tag('link', :rel => 'canonical', :href => "http://" + Spree::Config[:site_url] + URI.parse(@canonical_url).path)

    4 changes: 4 additions & 0 deletions canonical_url_override.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    Deface::Override.new(:virtual_path => 'spree/layouts/spree_application',
    :name => 'canonical_url',
    :insert_bottom => "[data-hook='inside_head']",
    :partial => 'shared/canonical_url')
    9 changes: 9 additions & 0 deletions products_controller_decorator.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    module Spree
    ProductsController.class_eval do
    before_filter :show_filter, :only => :show

    def show_filter
    @canonical_url = spree.product_path(:id => @product.permalink)
    end
    end
    end
  3. ehoch revised this gist Jan 25, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Canonical URLS.md
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    Intro goes here[https://www.alarmgrid.com]
    [Alarm Grid](https://www.alarmgrid.com) will show you how to create canonical urls in Spree Commerce.
  4. ehoch renamed this gist Jan 25, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. ehoch revised this gist Jan 25, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Canonical URLS
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    Intro goes here
    Intro goes here[https://www.alarmgrid.com]
  6. ehoch created this gist Jan 25, 2013.
    1 change: 1 addition & 0 deletions Canonical URLS
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Intro goes here