Skip to content

Hugo: Update remote resource handling for version bump #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions layouts/_default/docs.html

This file was deleted.

72 changes: 71 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,72 @@
{{ .Render "docs" }}
{{ define "main" }}
<div class="docs-container row override-sidebar-collapse">
<nav id="sidebar" class="sidenav overflow-auto col-md-3 d-none d-xl-block d-print-none align-top">
{{ partial "sidebar.html" . }}
</nav>

<!-- Replace icons -->
{{ $content := partial "icon-replacement.html" (dict "content" .Content) }}

{{if (.Params.catalog) }}
<main class="content content-has-toc" role="main">
{{ else if and (gt .WordCount 200 ) (.Params.toc) }}
<main class="content col d-block align-top content-has-toc" role="main">
{{ else }}
<main class="content col d-block align-top content-no-toc" role="main">
{{ end }}

<section class="main-layout">
<div class="sidebar-layout" id="sidebar-layout">
<button class="sidebar__mobile__toggle" aria-expanded="false" data-mf="true">{{ partial "lucide" (dict "context" . "icon" "x")}}Close</button>
<nav data-mf="true" id="sidebar-v2" class="sidebar">
{{ partial "sidebar-v2.html" . }}
</nav>
</div>

<section id="maincontent" class="content-layout">
<div data-cms-edit="content" class="text-content">
<section class="breadcrumb-layout wide" data-mf="true" style="display: none;">
{{ if not .IsHome }}
{{ if not (in .Params.display_breadcrumb "false" ) }}
{{ partial "breadcrumb" .}}
{{ end }}
{{ end }}
</section>
{{ partial "banner" .}}
<h1>{{ .Title }}</h1>
{{ $content | safeHTML }}
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}
{{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }}

<hr>

{{ if .Page.Lastmod }}
<div class="last-modified">
{{ partial "page-meta-links" . }}
</div>
{{ end }}

{{ partial "version-list" . }}
{{ partial "qualtrics-feedback.html" }}

{{ partial "previous-next-links-in-section-with-title.html" . }}
</main>
{{ if and (gt .WordCount 200 ) (.Params.toc) }}
{{ if (add (len (findRE "<h3" .Content)) (len (findRE "<h2" .Content))) }}
<div id="toc" class="col-md-3 d-none d-xl-block d-print-none nginx-toc align-top">
{{ partial "toc.html" . }}
</div>
{{ end }}
{{ end }}

</div>
</section>
</section>
</div>
<!-- If there is a script defined in the page metadata, load it -->
{{if .Params.script}}
{{ $script := (delimit (slice "scripts" .Params.script) "/")}}
{{ partial (string $script) .}}
{{end }}

{{ end }}
7 changes: 1 addition & 6 deletions layouts/shortcodes/dimensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@
{{ $jsPath := replace $rawJSPath "/static" "" }}
{{ $dimensionsRef := dict }}
{{ with resources.Get $jsPath }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $dimensionsRef = . | transform.Unmarshal }}
{{ end }}
{{ else }}
{{ errorf "Unable to get asset resource %q" $jsPath }}
{{ errorf "Unable to get asset resource %q" $jsPath }}
{{ end }}


<div class="row flex-xl-nowrap">


Expand Down
8 changes: 4 additions & 4 deletions layouts/shortcodes/ghcode.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{ $file := .Get 0 }}
{{ $params := .Get 1 }}
{{ $codeBlockId := printf "id-%x" (now.UnixNano) }}
{{ with resources.GetRemote $file }}
{{ with try (resources.GetRemote $file) }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $lang := path.Ext $file | strings.TrimPrefix "." }}
<div id="code-block-v1" data-mf="false">
{{ highlight .Content $lang $params }}
{{ highlight .Value $lang $params }}
</div>

<div class="code-block" data-mf="true" style="display: none;">
Expand All @@ -17,10 +17,10 @@
<div class="code-container chroma">
<button onclick="copyToClipBoard(this, {{ $codeBlockId }})" class="code-copy-button multi-line" type="button">Copy</button>
<div class="highlight-v2" id="{{ $codeBlockId }}">
{{ highlight .Content $lang $params }}
{{ highlight .Value $lang $params }}
</div>
</div>
</div>
</div>
{{ end }}
{{ else }}
{{ errorf "Unable to load github content from %s from %q" $file .Position}}
Expand Down
4 changes: 0 additions & 4 deletions layouts/shortcodes/metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
{{ $jsPath := replace $rawJSPath "/static" "" }}
{{ $metricsRef := dict }}
{{ with resources.Get $jsPath }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $metricsRef = . | transform.Unmarshal }}
{{ end }}
{{ else }}
{{ errorf "Unable to get asset resource %q" $jsPath }}
{{ end }}
Expand Down
Loading