diff --git a/layouts/partials/dependencies/openapi.html b/layouts/partials/dependencies/openapi.html
index bbf94eac32..8d314e4310 100644
--- a/layouts/partials/dependencies/openapi.html
+++ b/layouts/partials/dependencies/openapi.html
@@ -1,23 +1,26 @@
{{- $page := .page }}
{{- with $page }}
{{- $urlOpenapi := "" }}
+ {{- $relOpenapi := "" }}
+ {{- $cssInProject := false }}
{{- if and (isset .Params "customopenapiurl") .Params.customOpenapiURL }}
{{- $urlOpenapi = .Params.customOpenapiURL }}
+ {{- $relOpenapi = .Params.customOpenapiURL }}
{{- else if and (isset .Site.Params "customopenapiurl") .Site.Params.customOpenapiURL }}
{{- $urlOpenapi = .Site.Params.customOpenapiURL }}
+ {{- $relOpenapi = .Site.Params.customOpenapiURL }}
{{- else }}
- {{- $urlOpenapi = "js/swagger-ui/swagger-ui-bundle.js" | relURL }}
- {{- if not .Site.Params.disableAssetsBusting }}
- {{- $urlOpenapi = printf "%s?%d" $urlOpenapi now.Unix }}
+ {{- $urlOpenapi = printf "%s%s" ("js/swagger-ui/swagger-ui-bundle.js" | relURL) (cond .Site.Params.disableAssetsBusting "" (printf "?%d" now.Unix)) }}
+ {{- $relOpenapi = printf "%s%s" ("/js/swagger-ui/swagger-ui-bundle.js") (cond .Site.Params.disableAssetsBusting "" (printf "?%d" now.Unix)) }}
+ {{- $cssInProject = true }}
{{- end }}
- {{- end }}
{{- $urlOpenapi := replace $urlOpenapi "swagger-ui-bundle" "swagger-ui-standalone-preset" }}
- {{- $urlOpenapi := replace $urlOpenapi "swagger-ui-standalone-preset" "swagger-ui" }}
- {{- $urlOpenapi := replace $urlOpenapi ".js" ".css" }}
+ {{- $relOpenapi := replace $relOpenapi "swagger-ui-bundle" "swagger-ui" }}
+ {{- $relOpenapi := replace $relOpenapi ".js" ".css" }}
{{- end }}
\ No newline at end of file
diff --git a/layouts/partials/toBaseRelURL.hugo b/layouts/partials/toBaseRelURL.hugo
index 677d3fa084..8e7068e0e4 100644
--- a/layouts/partials/toBaseRelURL.hugo
+++ b/layouts/partials/toBaseRelURL.hugo
@@ -1,8 +1,7 @@
+{{- $subdir := strings.TrimSuffix (relLangURL "/") (relLangURL "") }}
{{- $url := .RelPermalink }}
{{- $url = replaceRE "/[^/]*$" "" $url }}
-{{- $home_url := .Site.Home.RelPermalink }}
-{{- $home_url = replaceRE "/[^/]*$" "" $home_url }}
-{{- $rel_url := strings.TrimPrefix $home_url $url }}
+{{- $rel_url := strings.TrimPrefix $subdir $url }}
{{- $rel_url = replaceRE "/[^/]*" "/.." $rel_url }}
{{- $rel_url = trim $rel_url "/" }}
{{- return $rel_url }}
\ No newline at end of file
diff --git a/static/js/theme.js b/static/js/theme.js
index ea5a415719..51b5a02025 100644
--- a/static/js/theme.js
+++ b/static/js/theme.js
@@ -1523,7 +1523,7 @@ if( window.themeUseMermaid ){
}
function useOpenapi( config ){
- if( config.css && config.css.startsWith( '/' ) ){
+ if( config.css && config.cssInProject ){
config.css = window.relearn.baseUri + config.css;
}
}