mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
theme: attempt to remove relative URL hack #804
This commit is contained in:
parent
17b38325c4
commit
b178d3ea99
1 changed files with 2 additions and 5 deletions
|
@ -28,12 +28,9 @@
|
||||||
<link href="{{"css/ie.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
<link href="{{"css/ie.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||||
<script src="{{"js/url.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
<script src="{{"js/url.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||||
<script src="{{"js/variant.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
<script src="{{"js/variant.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||||
<script id="R-inline-script" data-root-url="/">
|
<script>
|
||||||
{{ "// hack to let hugo tell us how to get to the root when using relativeURLs, it needs to be called *url= for it to do its magic:" | safeJS }}
|
|
||||||
{{ "// https://github.com/gohugoio/hugo/blob/145b3fcce35fbac25c7033c91c1b7ae6d1179da8/transform/urlreplacers/absurlreplacer.go#L72" | safeJS }}
|
|
||||||
var root_url=document.querySelector( '#R-inline-script' ).dataset.rootUrl;
|
|
||||||
window.relearn = window.relearn || {};
|
window.relearn = window.relearn || {};
|
||||||
window.relearn.baseUri=root_url.replace(/\/*$/, '');
|
window.relearn.baseUri='{{ "css/theme.css" | relURL | safeJS }}'.replace(/(.*)css\/theme\.css/, '$1').replace(/\/*$/, '');
|
||||||
window.relearn.baseUriFull='{{ .Site.BaseURL | safeJS }}/'.replace(/\/*$/, '');
|
window.relearn.baseUriFull='{{ .Site.BaseURL | safeJS }}/'.replace(/\/*$/, '');
|
||||||
{{- with .Site.Home.OutputFormats.Get "json" }}
|
{{- with .Site.Home.OutputFormats.Get "json" }}
|
||||||
{{- warnf "%q: DEPRECATED usage of 'json' output format found, use 'search' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/customization#activate-search" $page.File.Filename }}
|
{{- warnf "%q: DEPRECATED usage of 'json' output format found, use 'search' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/customization#activate-search" $page.File.Filename }}
|
||||||
|
|
Loading…
Reference in a new issue