Skip to content

Commit

Permalink
Creating the sitemap and editing the robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ-Kulundu committed May 27, 2023
1 parent 0635339 commit 9039e33
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
25 changes: 24 additions & 1 deletion config/sitemap.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "http://www.example.com"
SitemapGenerator::Sitemap.default_host = "https://rubycommunity.africa"
SitemapGenerator::Sitemap.compress = false

SitemapGenerator::Sitemap.create do
# Put links creation logic here.
Expand All @@ -24,4 +25,26 @@
# 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
5 changes: 5 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@ 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
1 change: 1 addition & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:pagemap="http://www.google.com/schemas/sitemap-pagemap/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://rubycommunity.africa</loc><lastmod>2023-05-27T10:44:44+03:00</lastmod><changefreq>weekly</changefreq><priority>1.0</priority></url><url><loc>https://rubycommunity.africa/about</loc><lastmod>2023-05-27T10:44:44+03:00</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url><url><loc>https://rubycommunity.africa/learn</loc><lastmod>2023-05-27T10:44:44+03:00</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url><url><loc>https://rubycommunity.africa/chapters</loc><lastmod>2023-05-27T10:44:44+03:00</lastmod><changefreq>monthly</changefreq><priority>0.9</priority></url></urlset>

0 comments on commit 9039e33

Please sign in to comment.