mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
parent
4da0ebbaf8
commit
d0cc34396d
5 changed files with 14 additions and 4 deletions
|
@ -14,7 +14,7 @@
|
|||
<title>{{ $title }}</title>
|
||||
<base href="{{ .Site.BaseURL }}">
|
||||
{{- partialCached "favicon.html" . }}
|
||||
{{- partialCached "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) $outputFormat }}
|
||||
{{- partial "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) }}
|
||||
<style>
|
||||
p {
|
||||
text-align: center
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
{{- end }}
|
||||
|
||||
{{- partialCached "favicon.html" . }}
|
||||
{{- partialCached "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) $outputFormat }}
|
||||
{{- partial "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) }}
|
||||
{{- partial "dependencies.html" (dict "page" . "location" "header" "outputFormat" $outputFormat) }}
|
||||
{{- partial "custom-header.html" . }}
|
||||
</head>
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<script src="{{"js/variant.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script>
|
||||
window.relearn = window.relearn || {};
|
||||
window.relearn.baseUri='{{ "css/theme.css" | relURL | safeJS }}'.replace(/(.*)css\/theme\.css/, '$1').replace(/\/*$/, '');
|
||||
window.relearn.baseUriFull='{{ .Site.BaseURL | safeJS }}/'.replace(/\/*$/, '');
|
||||
window.relearn.baseUri='{{ partial "toBaseRelURL.hugo" $page | safeJS }}';
|
||||
window.relearn.baseUriFull='{{ replaceRE "/*$" "" .Site.BaseURL | safeJS }}';
|
||||
{{- 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 }}
|
||||
window.index_json_url={{ "index.json" | relLangURL }};
|
||||
|
|
7
layouts/partials/toBaseRelURL.hugo
Normal file
7
layouts/partials/toBaseRelURL.hugo
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}
|
||||
{{- $url = path.Clean $url }}
|
||||
{{- $url = replaceRE "/[^/]*$" "" $url }}
|
||||
{{- $url = replaceRE "/[^/]*" "/.." $url }}
|
||||
{{- $url = replaceRE "^/" "" $url }}
|
||||
{{- $url = replaceRE "/$" "" $url }}
|
||||
{{- return $url }}
|
|
@ -1523,6 +1523,9 @@ if( window.themeUseMermaid ){
|
|||
}
|
||||
|
||||
function useOpenapi( config ){
|
||||
if( config.css && config.css.startsWith( '/' ) ){
|
||||
config.css = window.relearn.baseUri + config.css;
|
||||
}
|
||||
}
|
||||
if( window.themeUseOpenapi ){
|
||||
useOpenapi( window.themeUseOpenapi );
|
||||
|
|
Loading…
Reference in a new issue