File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,14 @@ def generate_guide(guide, output_file)
186
186
187
187
view = ActionView ::Base . with_empty_template_cache . with_view_paths (
188
188
[ @source_dir ] ,
189
- edge : @edge ,
190
- version : @version ,
191
- epub : "epub/#{ epub_filename } " ,
192
- language : @language ,
193
- direction : @direction ,
194
- uuid : SecureRandom . uuid ,
195
- digest_paths : @digest_paths
189
+ edge : @edge ,
190
+ version : @version ,
191
+ epub : "epub/#{ epub_filename } " ,
192
+ language : @language ,
193
+ direction : @direction ,
194
+ uuid : SecureRandom . uuid ,
195
+ digest_paths : @digest_paths ,
196
+ canonical_url : canonical_url ( output_file )
196
197
)
197
198
view . extend ( Helpers )
198
199
@@ -223,6 +224,12 @@ def generate_guide(guide, output_file)
223
224
end if !dry_run?
224
225
end
225
226
227
+ def canonical_url ( path )
228
+ url = "https://guides.rubyonrails.org/"
229
+ url += path unless path == "index.html"
230
+ url
231
+ end
232
+
226
233
def warn_about_broken_links ( html )
227
234
anchors = extract_anchors ( html )
228
235
check_fragment_identifiers ( html , anchors )
Original file line number Diff line number Diff line change 13
13
14
14
< link rel ="apple-touch-icon " href ="images/icon.png ">
15
15
16
+ < link rel ="canonical " href ="<%= @canonical %> ">
17
+
16
18
< script src ="<%= digest_path ( 'javascripts/@hotwired--turbo.js' ) %> " data-turbo-track ="reload "> </ script >
17
19
< script src ="<%= digest_path ( 'javascripts/clipboard.js' ) %> " data-turbo-track ="reload "> </ script >
18
20
< script src ="<%= digest_path ( 'javascripts/guides.js' ) %> " data-turbo-track ="reload "> </ script >
You can’t perform that action at this time.
0 commit comments