Use page_route() for custom.css, custom.js, and MathJax

This commit is contained in:
Watal M. Iwasaki
2020-06-14 23:02:24 +09:00
parent e49758334f
commit 6e6d9d8c1f
2 changed files with 19 additions and 7 deletions
+4 -4
View File
@@ -8,7 +8,7 @@
{{#sprockets_stylesheet_tag}}app{{/sprockets_stylesheet_tag}} {{#sprockets_stylesheet_tag}}app{{/sprockets_stylesheet_tag}}
{{#sprockets_stylesheet_tag}}print print{{/sprockets_stylesheet_tag}} {{#sprockets_stylesheet_tag}}print print{{/sprockets_stylesheet_tag}}
{{#css}}<link rel="stylesheet" type="text/css" href="{{custom_path}}/custom.css" media="all">{{/css}} {{#css}}<link rel="stylesheet" type="text/css" href="{{custom_css}}" media="all">{{/css}}
{{#noindex}}<meta name="robots" content="noindex, nofollow" />{{/noindex}} {{#noindex}}<meta name="robots" content="noindex, nofollow" />{{/noindex}}
@@ -49,11 +49,11 @@
}; };
</script> </script>
{{#mathjax_config}} {{#mathjax_config}}
<script type="text/javascript" src="{{base_url}}/{{mathjax_config}}"></script> <script type="text/javascript" src="{{mathjax_config}}"></script>
{{/mathjax_config}} {{/mathjax_config}}
<script defer src="{{base_url}}/gollum/assets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script defer src="{{mathjax_js}}"></script>
{{/mathjax}} {{/mathjax}}
{{#js}}<script type="text/javascript" src="{{custom_path}}/custom.js"></script>{{/js}} {{#js}}<script type="text/javascript" src="{{custom_js}}"></script>{{/js}}
<title>{{title}}</title> <title>{{title}}</title>
</head> </head>
+15 -3
View File
@@ -26,12 +26,24 @@ module Precious
!@path.nil? !@path.nil?
end end
def base_url def custom_path
@base_url @base_url
end end
def custom_path def custom_css
"#{@base_url}" clean_url(custom_path, "custom.css")
end
def custom_js
clean_url(custom_path, "custom.js")
end
def mathjax_config
page_route(@mathjax_config)
end
def mathjax_js
page_route("gollum/assets/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML")
end end
def css # custom css def css # custom css