Skip to content
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

[SEO 8.] Add canonical url to API docs, remove news category #221

Merged
merged 6 commits into from
Dec 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions _lib/tasks/api_doc.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace :api do
task :generate_docs do
canonical_url = 'https://docs.knapsackpro.com/api/v1/'
raml2html = 'node_modules/raml2html/bin/raml2html'

raml_files = [
Expand All @@ -20,6 +21,12 @@ 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
ArturT marked this conversation as resolved.
Show resolved Hide resolved

puts "Compilation done for #{file[:src]}. Generated the #{file[:dest]} file."
else
puts "Something failed during RAML to HTML compilation for #{raml_file}."
Expand Down
Loading