We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 43bc13c commit fda2a02Copy full SHA for fda2a02
_lib/tasks/api_doc.rake
@@ -1,5 +1,6 @@
1
namespace :api do
2
task :generate_docs do
3
+ canonical_url = 'https://docs.knapsackpro.com/api/v1/'
4
raml2html = 'node_modules/raml2html/bin/raml2html'
5
6
raml_files = [
@@ -20,6 +21,12 @@ namespace :api do
20
21
Kernel.system(cmd)
22
exitstatus = $?.exitstatus
23
if exitstatus.zero?
24
+ html_contents = File.read(html_file)
25
+ html_contents.gsub!('<head>', '<head><link rel="canonical" href="'+canonical_url+'" />')
26
+ File.open(html_file, 'w') do |f|
27
+ f.write(html_contents)
28
+ end
29
+
30
puts "Compilation done for #{file[:src]}. Generated the #{file[:dest]} file."
31
else
32
puts "Something failed during RAML to HTML compilation for #{raml_file}."
0 commit comments