-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from gwu-libraries/t17-seo-optimization
T17 seo optimization. Was able to run rake tasks (generate and ping) and generate sitemap.xml and updated robots.txt. Fixes #17
- Loading branch information
Showing
6 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,6 @@ | |
/log/* | ||
!/log/.keep | ||
/tmp | ||
|
||
# Ignore sitemap | ||
public/sitemap.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class SitemapRegenerateJob < ActiveJob::Base | ||
def perform | ||
Rake::Task['sitemap:generate'].invoke | ||
Rake::Task['sitemap:ping'].invoke | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Sitemap::Generator.instance.load(host: 'example.com') do | ||
path :root, priority: 1, change_frequency: 'weekly' | ||
path :search_catalog, priority: 1, change_frequency: 'weekly' | ||
read_group = Solrizer.solr_name('read_access_group', :symbol) | ||
Work.where(read_group => 'public').each do |f| | ||
literal Rails.application.routes.url_helpers.curation_concerns_work_path(f), | ||
priority: 1, change_frequency: 'weekly' | ||
end | ||
Collection.where(read_group => 'public').each do |c| | ||
literal Rails.application.routes.url_helpers.collection_path(c), | ||
priority: 1, change_frequency: 'weekly' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace :gwss do | ||
# adding a logger since it got removed from our gemset | ||
def logger | ||
Rails.logger | ||
end | ||
|
||
desc "Queues a job to (re)generate the sitemap.xml" | ||
task "sitemap_queue_generate" => :environment do | ||
SitemapRegenerateJob.perform_later | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file | ||
# | ||
# To ban all spiders from the entire site uncomment the next two lines: | ||
# User-agent: * | ||
# Disallow: / | ||
User-agent: * | ||
Disallow: /*?file=thumbnail$ | ||
Sitemap: https://example.com/sitemap.xml | ||
User-agent: AhrefsBot | ||
Disallow: / | ||
User-agent: Pcore-HTTP/v0.23.20 | ||
Disallow: / |