diff --git a/Gemfile b/Gemfile index 5add7f3e..5b298df3 100644 --- a/Gemfile +++ b/Gemfile @@ -41,6 +41,9 @@ gem 'redis', '~> 4.0' # Devise 4.0 works with Rails 4.1 onwards. gem 'devise' +#A dynamic sitemap generator gem for the Ruby on Rails framework +gem 'sitemap_generator' + # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] # gem "bcrypt", "~> 3.1.7" diff --git a/Gemfile.lock b/Gemfile.lock index 34b203d8..cd1df74a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -330,6 +330,8 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) + sitemap_generator (6.3.0) + builder (~> 3.0) sprockets (4.0.3) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -412,6 +414,7 @@ DEPENDENCIES sendgrid-actionmailer (~> 3.2) simple_form (~> 5.1) simplecov + sitemap_generator sprockets-rails stimulus-rails turbo-rails diff --git a/app/views/chapters/index.html.erb b/app/views/chapters/index.html.erb index b59c03b9..e6b11f54 100644 --- a/app/views/chapters/index.html.erb +++ b/app/views/chapters/index.html.erb @@ -1,3 +1,5 @@ +<% content_for(:title,"Chapters") %> +<% content_for(:description," A showcase of the different ruby communities spread across the East African region.") %>

Chapters @@ -9,7 +11,7 @@
<%= image_tag chapter.image.attached? ? chapter.image.url : image_path('chapter.jpg'), - alt: 'Local meetups photo', + alt: chapter.name, class: "rounded-lg rounded-tl-2xl" %> diff --git a/app/views/landing/about.html.erb b/app/views/landing/about.html.erb index 7458187d..ec46a3e4 100644 --- a/app/views/landing/about.html.erb +++ b/app/views/landing/about.html.erb @@ -1,3 +1,5 @@ +<% content_for(:title,"About us") %> +<% content_for(:description,"The community hosts weekly and monthly meetups in different cities in East Africa. The community brings you Ruby Conference every year with different themes to fill the gap that exist between school and industry and in return helps spur innovation and growth in contribution to global economy") %>
<%= image_tag image_path('workshop.jpg'), class: "pt-20 w-fit h-fit", style: "filter: brightness(40%);" %>
diff --git a/app/views/landing/learn.html.erb b/app/views/landing/learn.html.erb index c4eeb89e..4743dcb7 100644 --- a/app/views/landing/learn.html.erb +++ b/app/views/landing/learn.html.erb @@ -1,3 +1,5 @@ +<% content_for(:title,"Learning Materials") %> +<% content_for(:description,"A list of ruby and ruby on rails learning resources compiled by the ARC community") %>

Featured learning materials diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0215727e..e34842bd 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,8 @@ - ArcPlatform + ArcPlatform <%= " - " + yield(:title) if content_for?(:title)%> + > <%= csrf_meta_tags %> <%= csp_meta_tag %> diff --git a/config/sitemap.rb b/config/sitemap.rb new file mode 100644 index 00000000..8be8cda7 --- /dev/null +++ b/config/sitemap.rb @@ -0,0 +1,50 @@ +# Set the host name for URL creation +SitemapGenerator::Sitemap.default_host = "https://rubycommunity.africa" +SitemapGenerator::Sitemap.compress = false + +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 + + add '/about', + changefreq: 'monthly', + priority: 0.9 + add '/learn', + changefreq: 'monthly', + priority: 0.9 + add '/chapters', + changefreq: 'monthly', + priority: 0.9 + + Chapter.find_each do |chapter| + add chapter_path(chapter), :lastmod => chapter.updated_at + end + + add '/users/sign_up', + changefreq: 'monthly', + priority: 0.8 + + add '/users/sign_in', + changefreq: 'monthly', + priority: 0.8 +end diff --git a/public/robots.txt b/public/robots.txt index c19f78ab..08e06add 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1 +1,17 @@ # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +User-agent: * + +Disallow: /admin +Disallow: /chapters/new +Disallow: /chapters/edit +Disallow: /countries/new +Disallow: /countries/edit +Disallow: /projects/new +Disallow: /projects/edit +Disallow: /users/ +# Overriding /users route to add the sign in and sign up page to be indexed +Allow: /users/sign_up +Allow: /users/sign_in + + +Sitemap: https://rubycommunity.africa/sitemap.xml \ No newline at end of file diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 00000000..84ab9b1d --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1 @@ +https://rubycommunity.africa2023-05-27T10:44:44+03:00weekly1.0https://rubycommunity.africa/about2023-05-27T10:44:44+03:00monthly0.9https://rubycommunity.africa/learn2023-05-27T10:44:44+03:00monthly0.9https://rubycommunity.africa/chapters2023-05-27T10:44:44+03:00monthly0.9 \ No newline at end of file