Browse Source

SEO work and resources page

development
Godwin 10 years ago
parent
commit
08aecce225
  1. 1
      Gemfile
  2. 3
      Gemfile.lock
  3. 3
      app/assets/stylesheets/sass/_layout.scss
  4. 3
      app/controllers/conferences_controller.rb
  5. 18
      app/controllers/pages_controller.rb
  6. 16
      app/helpers/application_helper.rb
  7. 5
      app/views/conferences/index.html.haml
  8. 17
      app/views/conferences/permission_denied.html.haml
  9. 6
      app/views/conferences/show.html.haml
  10. 10
      app/views/layouts/application.html.haml
  11. 1
      app/views/organizations/index.html.haml
  12. 7
      app/views/organizations/show.html.haml
  13. 1
      app/views/pages/home.html.haml
  14. 9
      app/views/pages/permission_denied.html.haml
  15. 25
      app/views/pages/resources.html.haml
  16. 4
      app/views/pages/translation_list.html.haml
  17. 4
      app/views/pages/translations.html.haml
  18. 2
      app/views/shared/_footer.html.haml
  19. 2
      app/views/shared/_navbar.html.haml
  20. 21
      config/Xsitemap.rb
  21. 2
      config/robots-dev.txt
  22. 3
      config/robots-live.txt
  23. 3
      config/routes.rb
  24. 27
      config/sitemap.rb
  25. 0
      public/Xrobots.txt
  26. BIN
      public/maps/Thumbs.db
  27. BIN
      public/sitemap.xml.gz

1
Gemfile

@ -29,6 +29,7 @@ gem 'paper_trail'
gem 'font-awesome-rails'
gem 'wysiwyg-rails'
gem 'rails-assets-cdn'
gem 'sitemap_generator'
group :development, :test do
gem 'rspec'

3
Gemfile.lock

@ -279,6 +279,8 @@ GEM
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
sitemap_generator (5.0.4)
builder
slop (3.5.0)
sorcery (0.8.6)
bcrypt (~> 3.1)
@ -366,6 +368,7 @@ DEPENDENCIES
sass-rails (~> 4.0.0)
selenium-webdriver
simplecov
sitemap_generator
sorcery (>= 0.8.1)
uglifier (>= 1.3.0)
wdm (>= 0.1.0)

3
app/assets/stylesheets/sass/_layout.scss

@ -5,11 +5,12 @@
*/
html {
background-color: $white
background-color: $primary-color;
}
body {
height: auto;
background-color: $white
}
#main-nav {

3
app/controllers/conferences_controller.rb

@ -187,9 +187,6 @@ class ConferencesController < ApplicationController
if current_user
@host_privledge = :admin
end
#if !@conference
# raise ActionController::RoutingError.new('Not Found')
#end
end
def set_conference_registration

18
app/controllers/pages_controller.rb

@ -1,13 +1,16 @@
include ApplicationHelper
class PagesController < ApplicationController
#skip_before_filter :verify_authenticity_token, only: [:translate]
#skip_before_filter :verify_authenticity_token, only: [:translate]
def home
@conferences = Conference.all
@conferences = Conference.all
@conference = Conference.find(:first, :order => "start_date DESC")
end
def resources
end
def translate
key = params[:translationkey]
value = params[:translationvalue]
@ -51,12 +54,18 @@ class PagesController < ApplicationController
end
def translations
if !current_user
raise ActiveRecord::PremissionDenied
end
@lang = params[:lang]
@translations = I18n.backend.get_translation_info
I18n.config.enforce_available_locales = false
end
def translation_list
if !current_user
raise ActiveRecord::PremissionDenied
end
total = 0
complete = 0
@completeness = Hash.new
@ -78,6 +87,11 @@ class PagesController < ApplicationController
}
end
def robots
robot = is_production? && !is_test_server? ? 'live' : 'dev'
render :text => File.read("config/robots-#{robot}.txt"), :content_type => 'text/plain'
end
private
def store_translations(locale, data, options = {})
escape = options.fetch(:escape, true)

16
app/helpers/application_helper.rb

@ -41,6 +41,10 @@ module ApplicationHelper
content_for(:title) { page_title.to_s }
end
def description(page_description)
content_for(:description) { page_description.to_s }
end
def banner_image(banner_image, name: nil, id: nil, user_id: nil, src: nil)
@@no_banner = false
@@banner_image = banner_image
@ -459,6 +463,18 @@ module ApplicationHelper
(Rails.application.config.action_controller.asset_host || '') + file
end
def is_production?
Rails.env == 'production'
end
def subdomain
request.env['SERVER_NAME'].gsub(/^(\w+)\..*$/, '\1')
end
def is_test_server?
subdomain == 'test'
end
private
def _form_field(type, name, value, options)
if type == 'check_box'

5
app/views/conferences/index.html.haml

@ -1,4 +1,5 @@
- title _'page.Conferences'
- page_name = 'All '+(@conference_type ? @conference_type.title+' ' : '')+' Conferences'
- title page_name
- banner_image '/assets/conference.jpg'
- page_style :list
- content_for :banner do
@ -6,7 +7,7 @@
.columns
%h1=_'page.Conferences'
%h2='All '+(@conference_type ? @conference_type.title+' ' : '')+' Conferences'
%h2=page_name
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3.conference-list.preview-list
- @conferences.each do |conference|

17
app/views/conferences/permission_denied.html.haml

@ -1,8 +1,13 @@
- title 'Bike!Bike!'
- title @conference.title
= render 'header'
.row
%h1
=_'error.title.Permission_Denied'
%p
=_'error.desc.permission_denied', :p
%article.row
.columns.large-10
%h1=_'error.title.Permission_Denied'
%p=_'error.desc.permission_denied', :p
- content_for :side_bar do
%h5= @conference.title+' is hosted by:'
%ul.preview-list.org-list.small-block-grid-2.large-block-grid-1
- @conference.organizations.each do |organization|
%li=render 'organizations/preview', :organization => organization

6
app/views/conferences/show.html.haml

@ -1,4 +1,8 @@
- title 'Bike!Bike!'
- location = @conference.organizations.first.locations.first
- location_name = location.city + ', ' + (location.territory ? Carmen::Country.coded(location.country).subregions.coded(location.territory).name : location.country)
- title @conference.title
- description "#{@conference.title} conference in #{location_name} for DIY bicycle collectives, co-ops, and advocacy groups"
= render 'header'
= tabs!

10
app/views/layouts/application.html.haml

@ -3,17 +3,15 @@
%head
%meta{ charset: 'utf-8' }
%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' }
%title= yield_or_default :title, controller.action_name.titlecase
%meta{ name: 'description', content: (yield_or_default :description, 'Bike!Bike! is an international annual gathering organized by and for community bicycle projects') }
%title= (yield :title) + (content_for?(:title) ? ' | ' : '') + 'Bike!Bike!'
%meta{ name: 'description', content: (yield_or_default :description, 'Bike!Bike! conferences for DIY bicycle collectives, co-ops, and advocacy groups') }
= csrf_meta_tags
= yield :head
/ Le HTML5 shim, for IE6-8 support of HTML elements
/[if lt IE 9]
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
= stylesheet_link_tag '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic', 'application', media: 'all'
/ Touch icons
%link{ href: asset_path('favicon.ico'), rel: 'shortcut icon', type: 'image/x-icon' }
%link{ href: asset_path('favicon.ico'), rel: 'icon', type: 'image/x-icon' }
%link{ href: asset_path('apple-touch-icon.png'), rel: 'apple-touch-icon' }
@ -21,10 +19,6 @@
%link{ href: asset_path('apple-touch-icon-114x114.png'), rel: 'apple-touch-icon', sizes: '114x114' }
%link{ href: asset_path('apple-touch-icon-144x144.png'), rel: 'apple-touch-icon', sizes: '144x144' }
/
Le javascript
\==================================================
/ Placed at the top of the document 'cause of turbolinks
=# javascript_include_tag '//use.typekit.net/iqv7hcg.js'
=# javascript_include_tag 'application'
=# javascript_include_tag 'nested_form'

1
app/views/organizations/index.html.haml

@ -1,4 +1,5 @@
- title _'page.Organizations'
- description 'Bike!Bike! list of DIY bicycle collectives, co-ops, coops, community bike projects, advocacy by country, state, provice, and city'
- banner_image '/assets/orgs.jpg'
- page_style :list
- content_for :banner do

7
app/views/organizations/show.html.haml

@ -1,3 +1,8 @@
- territory = Carmen::Country.coded(@organization.locations[0].country).subregions.coded(@organization.locations[0].territory)
- location_name = @organization.locations[0].city + (territory ? ' ' + territory.name : '') + ', ' + Carmen::Country.coded(@organization.locations[0].country).name
- title @organization.name + ' (' + location_name + ')'
- description "#{@organization.name} is a bicycle collective, co-op, community bike project, or advocacy group in #{location_name}"
- banner_image @organization.cover_url, id: @organization.cover_attribution_id, name: @organization.cover_attribution_name, user_id: @organization.cover_attribution_user_id, src: @organization.cover_attribution_src
- page_style 'article'
- content_for :banner do
@ -8,7 +13,7 @@
.columns.info{:class => (@organization.avatar.is_landscape? ? nil : ['medium-6', 'medium-pull-6'])}
%h1=@organization.name
- territory = Carmen::Country.coded(@organization.locations[0].country).subregions.coded(@organization.locations[0].territory)
%h2=@organization.locations[0].city + (territory ? ' ' + territory.name : '') + ', ' + Carmen::Country.coded(@organization.locations[0].country).name
%h2=location_name
%p#notice= notice

1
app/views/pages/home.html.haml

@ -1,4 +1,3 @@
- title 'Bike!Bike!'
- has_no_content
- this_is_the_front_page
- if @conference

9
app/views/pages/permission_denied.html.haml

@ -0,0 +1,9 @@
- page_title = _'error.title.Permission_Denied'
- title page_title
- banner_title page_title
.row
%h1
='This page is inaccessible to you'
%p
=_'error.desc.permission_denied', :p

25
app/views/pages/resources.html.haml

@ -0,0 +1,25 @@
- page_title = 'Bike!Bike! Reources'
- title page_title
- banner_title page_title
- description 'Bike!Bike! list of resources - Bike Collective Wiki, ThinkTank, Bike!Bike! photos and documents'
.row
.columns
%p
Here is a list of online resources available to commmunity bike projects. The bike collective wiki in particlular has great start up kits and many helpful articles about how community bike shops operate. &nbsp;The think tank is a list serve with over 600 contributors. When you join the list, you can talk to community bike shops from all over the world about how to better organize and operate a shop.
%ul
%li
%a{href: 'http://www.bikecollectives.org/wiki/index.php?title=Main_Page', target: '_blank'}
Bike Collective Wiki
%li
%a{href: 'http://lists.bikecollectives.org/listinfo.cgi/thethinktank-bikecollectives.org', target: '_blank'}
Think tank sign up
%li
%a{href: 'http://www.flickr.com/photos/93412361@N07/with/8494632542/', target: '_blank'}
flickr bikebike!
%li
%a{href: 'https://www.dropbox.com/sh/4phyl9lft18whzi/SXQ6XUklKB', target: '_blank'}
Drop box for bikebike2012 (shared public box)
%p
If you have more resources you think should be listed here, please post them to the <a href="http://tqa.bikebike.org/project/issues/website" rel="external">issue tracker for the bikebike! website.</a></div></div>

4
app/views/pages/translation_list.html.haml

@ -1,4 +1,6 @@
- banner_title 'Translations'
- page_title = 'Translations'
- title page_title
- banner_title page_title
.row
%h1

4
app/views/pages/translations.html.haml

@ -1,4 +1,6 @@
- banner_title (_ 'language_translations', vars: {:language => (_ ('languages.' + @lang))})
- page_title = (_ 'language_translations', vars: {:language => (_ ('languages.' + @lang))})
- title page_title
- banner_title page_title
- page_style :form
.row

2
app/views/shared/_footer.html.haml

@ -4,7 +4,7 @@
%i
%a{href: '/conferences/'}='Organizations'
%i
%a{href: '/conferences/'}='Zine'
%a{href: '/resources/'}='Resources'
.columns.medium-3.large-3.text-right
&copy;2014 Bike!Bike!

2
app/views/shared/_navbar.html.haml

@ -7,4 +7,4 @@
.buttons
= link_to (_'Conferences'), :conferences, {:class => ['button', 'conference']}
= link_to (_'Organizations'), {:controller => :organizations}, {:class => ['button', 'organization']}
= link_to (_'Zine'), 'http://zinezine.bikebike.org', :class => ['button', 'article']
= link_to (_'Resources'), '/resources/', :class => ['button', 'article']

21
config/Xsitemap.rb

@ -0,0 +1,21 @@
SitemapGenerator::Sitemap.default_host = "http://hackingoff.com"
SitemapGenerator::Sitemap.create do
routes = Rails.application.routes.routes.map do |route|
{alias: route.name, path: route.path.spec.to_s, controller: route.defaults[:controller], action: route.defaults[:action]}
end
# Set a list of controllers you don't want to generate routes for.
# /rails/info in particular maps to something inaccessible.
# redirects have a nil controller. This prevents duplicate content penalties.
banned_controllers = ["rails/info", nil]
routes.reject! {|route| banned_controllers.include?(route[:controller])}
# sitemap_generator includes root by default; prevent duplication
routes.reject! {|route| route[:path] == '/'}
routes.each {|route| add route[:path][0..-11]} # Strips off '(.:format)
# Notice the below if you're hosting Jekyll/Octopress in a subdirectory
# or otherwise want to index content outside of Rails' routes.
# add_to_index '/path/sitemap.xml'

2
config/robots-dev.txt

@ -0,0 +1,2 @@
User-agent: *
Disallow: /

3
config/robots-live.txt

@ -0,0 +1,3 @@
User-agent: *
Disallow: /translations/
Disallow: /login/

3
config/routes.rb

@ -60,6 +60,9 @@ BikeBike::Application.routes.draw do
get "oauth/callback" => "oauths#callback"
get "oauth/:provider" => "oauths#oauth", :as => :auth_at_provider
get 'robots.txt' => 'pages#robots'
get 'resources' => 'pages#resources'
root 'pages#home'
end

27
config/sitemap.rb

@ -0,0 +1,27 @@
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "http://bikebike.org"
SitemapGenerator::Sitemap.create do
# Put links creation logic here.
#
# The root path '/' and sitemap index file are added automatically for you.
# Links are added to the Sitemap in the order they are specified.
#
# Usage: add(path, options={})
# (default options are used if you don't specify)
#
# Defaults: :priority => 0.5, :changefreq => 'weekly',
# :lastmod => Time.now, :host => default_host
#
# Examples:
#
# Add '/articles'
#
# add articles_path, :priority => 0.7, :changefreq => 'daily'
#
# Add all articles:
#
# Article.find_each do |article|
# add article_path(article), :lastmod => article.updated_at
# end
end

0
public/robots.txt → public/Xrobots.txt

BIN
public/maps/Thumbs.db

Binary file not shown.

BIN
public/sitemap.xml.gz

Binary file not shown.
Loading…
Cancel
Save