schoolie 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +56 -15
- data/lib/helpers/schoolie_helper.rb +10 -5
- data/lib/schoolie/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be154513ab375404085cb27f1f613f981806d363310ab9a338ddbdf23ebd2c6e
|
4
|
+
data.tar.gz: 6b367c4bfb76739d28a0d20fbc1685db68977d04aa14710230ae8958a18d4dc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cd533267eca777564624d01462e8c9ff2df2416cccd83e6fff289f9a30d7cda9e19b03ec5be39fea0c48d9ec391730c805f85f3abb706a7299eef1ccf487e9f
|
7
|
+
data.tar.gz: 5c49117108e7f738809ef74394ccc0c8b37c805e295fd78dbddc62b516899c9a1349f700211931fdca7eb2c3b3a0e9e7239ae9dffab54f06bc9af70abb0fe5d1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<a href="https://codeclimate.com/github/curationexperts/schoolie/maintainability"><img src="https://api.codeclimate.com/v1/badges/bc6ef5bc9e76c6c3dcc9/maintainability" /></a>
|
4
4
|
[](https://coveralls.io/github/curationexperts/schoolie?branch=main)
|
5
5
|
|
6
|
-
|
6
|
+
A gem that generates a site map and meta tags for google scholar (or any other tags you might want)
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
@@ -23,21 +23,20 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
Install your schoolie configuration file in ```config/schoolie.yml```
|
28
27
|
|
29
28
|
This file should contain contents similar to this:
|
30
29
|
|
31
30
|
```
|
32
31
|
---
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
32
|
+
static:
|
33
|
+
citation_dissertation_institution: Your University
|
34
|
+
attributes:
|
35
|
+
citation_title: title
|
36
|
+
citation_author: creator
|
37
|
+
citation_date: publication_date
|
38
|
+
citation_keywords: keywords
|
39
|
+
citation_pdf_url: permanent_url
|
41
40
|
```
|
42
41
|
|
43
42
|
The 'static' section will be written directly into the meta tags as is, attributes will be sent as method calls to the current curation
|
@@ -50,13 +49,55 @@ Missing methods will be ignored.
|
|
50
49
|
bundle exec rails schoolie:sitemap
|
51
50
|
```
|
52
51
|
|
53
|
-
|
52
|
+
The 'static' section maps a particular meta tag name to a static string
|
53
|
+
|
54
|
+
The attributes section maps meta tag names to _methods that will be
|
55
|
+
called on whatever you pass into the ```schoolie_tags``` helper_.
|
56
|
+
|
57
|
+
If the method does not exist, the tag will not be generated (though no
|
58
|
+
error will be thrown).
|
54
59
|
|
55
|
-
NB. this task just uses curl to query solr currently, so make sure you have that installed first
|
56
60
|
|
57
|
-
|
61
|
+
Call the helper like any other helper in your view:
|
62
|
+
|
63
|
+
|
64
|
+
```erb
|
65
|
+
<%= schoolie_tags my_object %>
|
66
|
+
```
|
67
|
+
That's all there is to it!
|
68
|
+
|
69
|
+
## SiteMaps
|
70
|
+
|
71
|
+
If you'd like to generate a sitemap for your Hyrax-based application, a simple rake task can be used (not included in schoolie):
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
task sitemap: :environment do
|
75
|
+
date_field = 'system_modified_dtsi'
|
76
|
+
result = ActiveFedora::SolrService.query("has_model_ssim:MyModel",
|
77
|
+
fq: "selectin_criteria:here",
|
78
|
+
fl: "id,#{date_field}",
|
79
|
+
sort: "sort_field,sortfield ASC",
|
80
|
+
rows: 20_000)
|
81
|
+
ids = result.map do |x|
|
82
|
+
["https://etd.example.com/concern/theses/#{x['id']}", x[date_field].to_s]
|
83
|
+
end
|
84
|
+
builder = Nokogiri::XML::Builder.new do |sitemap|
|
85
|
+
sitemap.urlset("xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
|
86
|
+
xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9",
|
87
|
+
"xsi:schemaLocation": "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd") {
|
88
|
+
ids.each { |url, date|
|
89
|
+
sitemap.url {
|
90
|
+
sitemap.loc url
|
91
|
+
sitemap.lastmod date
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
end
|
96
|
+
File.open(Rails.root.join("public", "sitemap.xml"), "w") { |f| f.write(builder.to_xml) }
|
97
|
+
end
|
98
|
+
```
|
58
99
|
|
59
|
-
|
100
|
+
Don't forget to add your sitemap url to robots.txt too!
|
60
101
|
|
61
102
|
## Contributing
|
62
103
|
|
@@ -10,11 +10,16 @@ module SchoolieHelper
|
|
10
10
|
tags = m["static"].map do |k, v|
|
11
11
|
tag.meta(name: k, value: v)
|
12
12
|
end
|
13
|
-
tags
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
tags = m["attributes"].inject(tags) do |m, (k, v)|
|
14
|
+
begin
|
15
|
+
[concern.send(v)].flatten.each do |z|
|
16
|
+
m << tag.meta(name: k, value: z)
|
17
|
+
end
|
18
|
+
rescue StandardError
|
19
|
+
warn("Undefined attribute mapping: #{k} -> #{v}")
|
20
|
+
end
|
21
|
+
m
|
22
|
+
end
|
18
23
|
tags.join("\n")
|
19
24
|
end
|
20
25
|
|
data/lib/schoolie/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schoolie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- McClain Looney
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionview
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
126
|
+
rubygems_version: 3.2.28
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: A gem to generate sitemaps & meta tags for Samvera repositories
|