Skip to content

Commit

Permalink
theme: rename dependencies.html #891
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Oct 11, 2024
1 parent dbfada8 commit fe70bb4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ See the `math`, `mermaid` and `openapi` shortcodes for examples.
If you are really into customization of the theme and want to use the dependency loader for your own locations, you can do this by simply calling it from inside of your overriden partials

````go
{{- partial "dependencies.html" (dict "page" . "location" "mylocation") }}
{{- partial "dependencies.gotmpl" (dict "page" . "location" "mylocation") }}
````

{{% /notice %}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{{- end }}
{{- partialCached "favicon.html" . }}
{{- partial "stylesheet.html" . }}
{{- partial "dependencies.html" (dict "page" . "location" "header") }}
{{- partial "dependencies.gotmpl" (dict "page" . "location" "header") }}
{{- partial "custom-header.html" . }}
</head>
<body class="mobile-support {{ with .Store.Get "relearnOutputFormat" }}{{ . }}{{ else }}html{{ end }}{{- if .Site.Params.disableInlineCopyToClipBoard }} disableInlineCopyToClipboard{{ end }}{{- if .Site.Params.disableHoverBlockCopyToClipBoard }} disableHoverBlockCopyToClipBoard{{ end }}" data-url="{{ partial "permalink.gotmpl" (dict "to" .) }}">
Expand Down Expand Up @@ -76,7 +76,7 @@
{{- $assetBusting := partialCached "assetbusting.gotmpl" . }}
<script src="{{"js/clipboard.min.js" | relURL}}{{ $assetBusting }}" defer></script>
<script src="{{"js/perfect-scrollbar.min.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "dependencies.html" (dict "page" . "location" "footer") }}
{{- partial "dependencies.gotmpl" (dict "page" . "location" "footer") }}
<script src="{{"js/theme.js" | relURL}}{{ $assetBusting }}" defer></script>
{{- partial "custom-footer.html" . }}
</body>
Expand Down
17 changes: 17 additions & 0 deletions layouts/partials/dependencies.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- $page := .page }}
{{- $location := .location }}
{{- partialCached "_relearn/dependencies.gotmpl" $page $page.Path }}
{{- range $k, $v := $page.Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" $v.name }}
{{- $hasnested := printf "relearnHasNested%s" $v.name }}
{{- $wants := or ($page.Page.Store.Get $has) (and ($page.Page.Store.Get "relearnIsNested") ($page.Page.Store.Get $hasnested)) }}
{{- if and $wants }}
{{- if $v.location }}
{{- warnf "DEPRECATED parameter 'location' for dependency '%s' configured in your hugo.toml, query the 'location' parameter inside your dependency loader instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/releasenotes/5/#5-27-0" $k}}
{{- end }}
{{- if or (not $v.location) (eq $location $v.location) }}
{{- $dep := printf "dependencies/%s.html" $k }}
{{- partial $dep (dict "page" $page "location" $location) }}
{{- end }}
{{- end }}
{{- end }}
19 changes: 2 additions & 17 deletions layouts/partials/dependencies.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
{{- $page := .page }}
{{- $location := .location }}
{{- partialCached "_relearn/dependencies.gotmpl" $page $page.Path }}
{{- range $k, $v := $page.Site.Params.relearn.dependencies }}
{{- $has := printf "has%s" $v.name }}
{{- $hasnested := printf "relearnHasNested%s" $v.name }}
{{- $wants := or ($page.Page.Store.Get $has) (and ($page.Page.Store.Get "relearnIsNested") ($page.Page.Store.Get $hasnested)) }}
{{- if and $wants }}
{{- if $v.location }}
{{- warnf "DEPRECATED parameter 'location' for dependency '%s' configured in your hugo.toml, query the 'location' parameter inside your dependency loader instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/releasenotes/5/#5-27-0" $k}}
{{- end }}
{{- if or (not $v.location) (eq $location $v.location) }}
{{- $dep := printf "dependencies/%s.html" $k }}
{{- partial $dep (dict "page" $page "location" $location) }}
{{- end }}
{{- end }}
{{- end }}
{{- warnf "DEPRECATED partial 'dependencies.html' used, use 'dependencies.gotmpl' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/releasenotes/7/#7-0-0" }}
{{- partial "dependencies.gotmpl" . }}

0 comments on commit fe70bb4

Please sign in to comment.