Skip to content

Commit

Permalink
refactor: adding canonical to api
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturT committed Dec 13, 2024
1 parent fda2a02 commit 7795261
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions _lib/tasks/api_doc.rake
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ namespace :api do
Kernel.system(cmd)
exitstatus = $?.exitstatus
if exitstatus.zero?
html_contents = File.read(html_file)
html_contents.gsub!('<head>', '<head><link rel="canonical" href="'+canonical_url+'" />')
File.open(html_file, 'w') do |f|
f.write(html_contents)
end
html = File
.read(html_file)
.gsub('<head>', <<~HEAD)
<head><link rel="canonical" href="#{canonical_url}" />
HEAD

File.open(html_file, 'w') { |f| f.write(html) }

puts "Compilation done for #{file[:src]}. Generated the #{file[:dest]} file."
else
Expand Down

0 comments on commit 7795261

Please sign in to comment.