-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sitemap & Google Scholar #379
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
5d14445
Add a basic cached sitemap. Some work remaining to flesh it out
mbarnett 408bd63
Make rubocop happy
mbarnett 5f4d25a
Cleanup
mbarnett 518dcb7
sitemap doesn't need to have a policy, it's always public!
pgwillia 257aa21
sitemap should only show public items
pgwillia d25bdd6
add sitemap to robots.txt
pgwillia 7cdb9d2
Replaced placeholder with updated_at now indexed in Solr
pgwillia 8a9990f
ResourceSync [http://www.openarchives.org/rs/1.1/]
pgwillia 6523939
https://scholar.google.ca/intl/en/scholar/inclusion.html#indexing
pgwillia bef291d
Merge branch 'master' into sitemap
pgwillia 5a9dfa6
Update Google Scholar metadata & sitemap to accomodate Thesis
pgwillia dd8aaca
sitemap should contain less than 50,000 targets
pgwillia 0c54ebf
WIP - notes from review and tests
pgwillia 9617268
Merge branch 'master' into sitemap
pgwillia 52b6f91
test that demonstrates that where visibility is not working as expected
pgwillia cbc98e6
Merge remote-tracking branch 'matt/composable_queries' into sitemap
pgwillia a2d6bf8
Make robots.txt dynamic based on ENV['RAILS_ALLOW_CRAWLERS']
pgwillia 508dfcc
move visibility constraints test to eliminate test order issues
pgwillia fac6395
finish sitemap testing
pgwillia 09e4ec4
Merge branch 'master' into sitemap
pgwillia c1b3344
fix test from upstream change
pgwillia 56e4d7e
learning about rails conventions
pgwillia bb89c15
Merge branch 'master' into sitemap
pgwillia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,10 @@ | ||
class RobotsController < ApplicationController | ||
|
||
skip_after_action :verify_authorized | ||
|
||
def robots | ||
respond_to :text | ||
expires_in 6.hours, public: true | ||
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,28 @@ | ||
class SitemapController < ApplicationController | ||
|
||
skip_after_action :verify_authorized | ||
|
||
def index; end | ||
|
||
def communities | ||
@communities = Community.all | ||
# TODO: consider using Rollbar to catch this kind of thing | ||
logger.warn 'communities sitemap should contain less than 50,000 targets' if @communities.count > 50_000 | ||
end | ||
|
||
def collections | ||
@collections = Collection.all | ||
logger.warn 'collections sitemap should contain less than 50,000 targets' if @collections.count > 50_000 | ||
end | ||
|
||
def items | ||
@items = Item.public | ||
logger.warn 'items sitemap should contain less than 50,000 targets' if @items.count > 50_000 | ||
end | ||
|
||
def theses | ||
@theses = Thesis.public | ||
logger.warn 'thesis sitemap should contain less than 50,000 targets' if @theses.count > 50_000 | ||
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
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
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 @@ | ||
<!-- Google Scholar metadata --> | ||
<meta name="citation_title" content="<%= @item.title%>"/> | ||
<% authors(@item).each do |author| %> | ||
<meta name="citation_author" content="<%= author %>"/> | ||
<% end %> | ||
<% if @item.sort_year.present? %> | ||
<meta name="citation_publication_date" content="<%= @item.sort_year %>"/> | ||
<% end %> | ||
<% if @item.file_sets.count > 0 %> | ||
<meta name="citation_pdf_url" content="<%= fileset_uri(@item.file_sets.first, :download) %>"/> | ||
<% end %> | ||
<meta name="dc.identifier" content="<%= @item.doi %>"/> | ||
<meta name="citation_doi" content="<%= @item.doi %>"/> |
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,7 @@ | ||
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file | ||
Sitemap: https://era.library.ualberta.ca/sitemap.xml | ||
|
||
<% unless Rails.configuration.allow_crawlers %> | ||
User-agent: * | ||
Disallow: / | ||
<% 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,27 @@ | ||
xml.instruct! :xml, version: '1.0' | ||
cache 'sitemap', expires_in: 24.hours do | ||
xml.urlset(xmlns: 'http://www.sitemaps.org/schemas/sitemap/0.9', | ||
'xmlns:rs' => 'http://www.openarchives.org/rs/terms/') do | ||
xml.rs :md, capability: 'resourcelist', at: Time.current.iso8601 | ||
xml.url do | ||
xml.loc root_url | ||
xml.lastmod Time.current.iso8601 | ||
xml.changefreq 'weekly' | ||
xml.priority 1 | ||
xml.rs :md, type: 'text/html' | ||
end | ||
|
||
objects.each do |object| | ||
xml.url do | ||
xml.loc item_url(object) | ||
xml.lastmod object.updated_at | ||
xml.changefreq 'weekly' | ||
xml.priority 1 | ||
xml.rs :md, type: 'text/html' | ||
object.file_sets.each do |file_set| | ||
xml << "\t#{file_set.sitemap_link}\n" | ||
end | ||
end | ||
end | ||
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,20 @@ | ||
xml.instruct! :xml, version: '1.0' | ||
cache 'sitemap', expires_in: 24.hours do | ||
xml.urlset(xmlns: 'http://www.sitemaps.org/schemas/sitemap/0.9') do | ||
xml.url do | ||
xml.loc root_url | ||
xml.lastmod Time.current.utc.iso8601 | ||
xml.changefreq 'weekly' | ||
xml.priority 1 | ||
end | ||
|
||
@collections.each do |collection| | ||
xml.url do | ||
xml.loc community_collection_url(collection.community, collection) | ||
xml.lastmod collection.updated_at | ||
xml.changefreq 'weekly' | ||
xml.priority 1 | ||
end | ||
end | ||
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,20 @@ | ||
xml.instruct! :xml, version: '1.0' | ||
cache 'sitemap', expires_in: 24.hours do | ||
xml.urlset(xmlns: 'http://www.sitemaps.org/schemas/sitemap/0.9') do | ||
xml.url do | ||
xml.loc root_url | ||
xml.lastmod Time.current.utc.iso8601 | ||
xml.changefreq 'weekly' | ||
xml.priority 1 | ||
end | ||
|
||
@communities.each do |community| | ||
xml.url do | ||
xml.loc community_url(community) | ||
xml.lastmod community.updated_at | ||
xml.changefreq 'weekly' | ||
xml.priority 1 | ||
end | ||
end | ||
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,8 @@ | ||
xml.instruct! :xml, version: '1.0' | ||
xml.sitemapindex xmlns: 'http://www.sitemaps.org/schemas/sitemap/0.9' do | ||
[:items, :theses, :collections, :communities].each do |category| | ||
xml.sitemap do | ||
xml.loc url_for(action: category, controller: 'sitemap', only_path: false) | ||
end | ||
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 @@ | ||
xml << render(partial: 'object', locals: { objects: @items }) |
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 @@ | ||
xml << render(partial: 'object', locals: { objects: @theses }) |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than have to escape all of these newlines, this is probably a great use-case for a heredoc: https://infinum.co/the-capsized-eight/multiline-strings-ruby-2-3-0-the-squiggly-heredoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually more like a run-on sentence situation. There should be no newlines or extra spaces/tabs between the values. My understanding is that heredoc would maintain newlines. Is there a solution to make something like that more readable?