mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
docs: update the framework of doc site (#207)
Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
This commit is contained in:
103
docSite/layouts/docs/baseof.html
Normal file
103
docSite/layouts/docs/baseof.html
Normal file
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html>
|
||||
{{ $.Scratch.Delete "social_list" }}
|
||||
<!-- social_list -->
|
||||
<!-- change -->
|
||||
{{ $social_params := slice "github" "twitter" "instagram" "rss" "wechat" }}
|
||||
{{ range $social_params }}
|
||||
{{ if isset site.Params.social . }}
|
||||
{{ $.Scratch.Add "social_list" (slice .) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<html lang="{{ site.LanguageCode }}">
|
||||
{{- partial (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "head.html") . -}}
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="page-wrapper toggled">
|
||||
{{- partial (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "sidebar.html") . -}}
|
||||
<!-- Start Page Content -->
|
||||
<main class="page-content bg-transparent">
|
||||
{{- partialCached (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "top-header.html") . -}}
|
||||
<div class="container-fluid">
|
||||
<div class="layout-spacing">
|
||||
{{ $currentPage := . -}}
|
||||
{{ if site.Params.docs.breadcrumbs | default true }}
|
||||
<div class="d-md-flex justify-content-between align-items-center">
|
||||
{{- partial (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "breadcrumbs.html") . -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="row flex-xl-nowrap">
|
||||
{{ if site.Params.docs.toc | default true }}
|
||||
<div class="docs-toc col-xl-3 {{ if .IsNode }}visually-hidden{{ else }}{{end}} {{ if and (ne .Params.toc false) (ne .TableOfContents "<nav id=\"TableOfContents\"></nav>") }}{{ else }}visually-hidden{{ end }} {{ if site.Params.docs.toc | default true }}{{ else }}visually-hidden{{ end }} d-xl-block">
|
||||
{{- partial (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "toc.html") . -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if site.Params.docs.tocMobile | default true }}
|
||||
<div class="docs-toc-mobile {{ if .IsNode }}visually-hidden{{ else }}{{end}} {{ if and (ne .Params.toc false) (ne .TableOfContents "<nav id=\"TableOfContents\"></nav>") }}{{ else }}visually-hidden{{ end }} {{ if site.Params.docs.tocMobile | default true }}{{ else }}visually-hidden{{ end }} d-print-none d-xl-none">
|
||||
<button id="toc-dropdown-btn" class="btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-offset="0,0" aria-expanded="false">
|
||||
Contents
|
||||
</button>
|
||||
{{- partial (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "toc-mobile.html") . -}}
|
||||
</div>
|
||||
{{ end -}}
|
||||
<div class="docs-content col-12 {{ if .IsNode }}{{ else }}{{ if site.Params.docs.toc | default true }}{{ if and (ne .Params.toc false) }}col-xl-9{{else}}{{end}}{{ else }}{{ end }}{{ end }} mt-0">
|
||||
<div class="mb-3">
|
||||
<h1 class="content-title mb-0">
|
||||
{{ if site.Params.docs.titleIcon | default false }}
|
||||
<i class="material-icons me-0">{{- .Params.icon | default "article" }}</i>
|
||||
{{ end }}
|
||||
<span class="title-text">
|
||||
{{ $currentPage.Title }}
|
||||
</span>
|
||||
{{ if .Draft }}
|
||||
<span class="badge bg-default fs-6 mb-1 align-middle">DRAFT</span>
|
||||
{{ end }}
|
||||
</h1>
|
||||
{{ if site.Params.docs.descriptions | default false }}
|
||||
<p class="lead mb-0">{{ $currentPage.Description | markdownify }}</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div id="content" class="main-content" {{ if eq .Site.Params.docs.toc true -}}data-bs-spy="scroll" data-bs-root-margin="0px 0px -65%" data-bs-target="#toc-mobile"{{ end }}>
|
||||
{{ block "main" . }}{{ end }}
|
||||
</div>
|
||||
<div>
|
||||
{{- partial (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "doc-nav.html") . -}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{- partialCached (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "footer.html") . -}}
|
||||
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ if site.Params.docs.backToTop | default true }}
|
||||
<!-- Back to top -->
|
||||
<button onclick="topFunction()" id="back-to-top" class="back-to-top fs-5"><svg width="24" height="24"><path d="M12,10.224l-6.3,6.3L4.32,15.152,12,7.472l7.68,7.68L18.3,16.528Z" style="fill:#fff"/></svg></button>
|
||||
<!-- Back to top -->
|
||||
{{ end }}
|
||||
|
||||
<!-- Dark Mode Switch JS -->
|
||||
{{ if eq .Site.Params.docs.darkMode true -}}
|
||||
{{ $darkModeSwitch := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/darkmode-switch.js") | js.Build | minify }}
|
||||
<script>{{ $darkModeSwitch.Content | safeJS }}</script>
|
||||
{{ end -}}
|
||||
|
||||
{{- partialCached (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "footer/footer-scripts.html") . -}}
|
||||
|
||||
<!-- DocSearch Config -->
|
||||
{{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}}
|
||||
{{- partialCached (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "footer/docsearch.html") . -}}
|
||||
{{ end }}
|
||||
|
||||
<!-- FlexSearch Config -->
|
||||
{{ if or (not (isset .Site.Params.flexsearch "enabled")) (eq .Site.Params.flexsearch.enabled true) -}}
|
||||
{{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}}
|
||||
{{ else }}
|
||||
{{- partialCached (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "footer/flexsearch.html") . -}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</body>
|
||||
{{- partial (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "modals.html") . -}}
|
||||
</html>
|
80
docSite/layouts/partials/docs/footer/footer-scripts.html
Normal file
80
docSite/layouts/partials/docs/footer/footer-scripts.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<style>
|
||||
.medium-zoom-overlay,
|
||||
.medium-zoom-image--opened {
|
||||
z-index: 1999;
|
||||
}
|
||||
</style>
|
||||
|
||||
{{ $dayjs := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/dayjs.min.js") }}
|
||||
{{ $relativeTime := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/relativeTime.min.js") }}
|
||||
{{ $app := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/app.js") -}}
|
||||
|
||||
{{ $slice := slice $dayjs $relativeTime $app -}}
|
||||
|
||||
{{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}}
|
||||
{{ $docsearch := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/docsearch.min.js") }}
|
||||
{{ $slice = $slice | append $docsearch -}}
|
||||
{{ end }}
|
||||
|
||||
{{ if site.Params.docs.toc | default true }}
|
||||
{{ if eq .Site.Params.docs.scrollSpy true -}}
|
||||
{{ $simplescrollspy := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/simple-scrollspy.min.js") }}
|
||||
{{ $slice = $slice | append $simplescrollspy -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if eq .Site.Params.docs.scrollSpy true -}}
|
||||
{{ $scrollspyScript := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/scrollspy-script.js") }}
|
||||
{{ $scrollspyScript := $scrollspyScript | js.Build -}}
|
||||
{{ $slice = $slice | append $scrollspyScript -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if site.Params.docs.tocMobile | default true }}
|
||||
{{ $tocmobilescrollspy := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/toc-mobile-scrollspy.js") }}
|
||||
{{ $slice = $slice | append $tocmobilescrollspy -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if eq .Site.Params.docs.prism true -}}
|
||||
{{ $prism := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/prism.js") }}
|
||||
{{ $prism := $prism | js.Build -}}
|
||||
{{ $slice = $slice | append $prism -}}
|
||||
{{ end -}}
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
{{ $js := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/bootstrap.js") }}
|
||||
{{ $params := dict }}
|
||||
{{ $sourceMap := cond hugo.IsProduction "" "inline" }}
|
||||
{{ $opts := dict "sourceMap" $sourceMap "minify" hugo.IsProduction "target" "es2018" "params" $params }}
|
||||
{{ $js = $js | js.Build $opts }}
|
||||
{{ if hugo.IsProduction }}
|
||||
{{ $js = $js | fingerprint "sha384" }}
|
||||
{{ end }}
|
||||
<script src="{{ $js.RelPermalink }}" {{ if hugo.IsProduction }}integrity="{{ $js.Data.Integrity }}"{{ end -}} defer></script>
|
||||
|
||||
{{ $js := $slice | resources.Concat (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/bundle.js") -}}
|
||||
|
||||
{{- if not .Site.IsServer }}
|
||||
{{- $js := $js | minify | fingerprint "sha384" }}
|
||||
<script type="text/javascript" src="{{ $js.Permalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous" defer></script>
|
||||
{{- else }}
|
||||
<script type="text/javascript" src="{{ $js.Permalink }}" defer></script>
|
||||
{{- end }}
|
||||
|
||||
<script
|
||||
src="https://cdn.jsdelivr.us/npm/medium-zoom/dist/medium-zoom.min.js"
|
||||
crossorigin="anonymous"
|
||||
referrerpolicy="no-referrer"
|
||||
></script>
|
||||
|
||||
<script>
|
||||
const images = Array.from(document.querySelectorAll(".main-content img"));
|
||||
images.forEach((img) => {
|
||||
mediumZoom(img, {
|
||||
margin: 0 /* The space outside the zoomed image */,
|
||||
scrollOffset: 40 /* The number of pixels to scroll to close the zoom */,
|
||||
container: null /* The viewport to render the zoom in */,
|
||||
template: null /* The template element to display on zoom */,
|
||||
background: "rgba(0, 0, 0, 0.8)"
|
||||
});
|
||||
});
|
||||
</script>
|
74
docSite/layouts/partials/docs/head.html
Normal file
74
docSite/layouts/partials/docs/head.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>
|
||||
{{- $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
|
||||
{{- if eq $url "/" }}
|
||||
{{- .Site.Title }}
|
||||
{{- else }}
|
||||
{{- if .Params.heading }}
|
||||
{{ .Params.heading }}
|
||||
{{ else }}
|
||||
{{- if eq .Title .Site.Title }}
|
||||
{{- .Title }}
|
||||
{{- else }}
|
||||
{{ .Site.Params.docs.Title | default (.Site.Title) }} | {{ .Title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
</title>
|
||||
{{- if not hugo.IsProduction }}
|
||||
<meta name="robots" content="noindex">
|
||||
{{- end }}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="A Modern Documentation Theme for Hugo" />
|
||||
<meta name="keywords" content="Documentation, Hugo, Hugo Theme, Bootstrap" />
|
||||
<meta name="author" content="Colin Wilson - Lotus Labs" />
|
||||
<meta name="email" content="support@aigis.uk" />
|
||||
<meta name="website" content="https://lotusdocs.dev" />
|
||||
<meta name="Version" content="v0.1.0" />
|
||||
<!-- favicon -->
|
||||
{{ block "favicon" . }}{{ partialCached (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "head/favicon.html") . }}{{ end }}
|
||||
<!-- Dark Mode -->
|
||||
{{ if eq .Site.Params.docs.darkMode true -}}
|
||||
{{ $darkModeInit := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/darkmode-init.js") | js.Build | minify -}}
|
||||
<script>{{ $darkModeInit.Content | safeJS }}</script>
|
||||
{{ end -}}
|
||||
<!-- FlexSearch -->
|
||||
{{ if or (not (isset .Site.Params.flexsearch "enabled")) (eq .Site.Params.flexsearch.enabled true) -}}
|
||||
{{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}}
|
||||
{{ else }}
|
||||
{{ $flexSearch := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "js/flexsearch.bundle.js") }}
|
||||
{{- if not .Site.IsServer }}
|
||||
{{ $flexSearch := $flexSearch | minify | fingerprint "sha384" }}
|
||||
<script type="text/javascript" src="{{ $flexSearch.Permalink }}" integrity="{{ $flexSearch.Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{ else }}
|
||||
<script type="text/javascript" src="{{ $flexSearch.Permalink }}"></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<!-- Google Fonts -->
|
||||
{{- partialCached "google-fonts" . }}
|
||||
<!-- Custom CSS -->
|
||||
{{- $options := dict "enableSourceMap" true }}
|
||||
{{- if hugo.IsProduction}}
|
||||
{{- $options := dict "enableSourceMap" false "outputStyle" "compressed" }}
|
||||
{{- end }}
|
||||
{{- $style := resources.Get (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "scss/style.scss") }}
|
||||
{{- $style = $style | resources.ExecuteAsTemplate (printf "/%s/%s" (.Site.Params.docs.pathName | default "docs") "scss/style.scss") . | resources.ToCSS $options }}
|
||||
{{- if hugo.IsProduction }}
|
||||
{{- $style = $style | minify | fingerprint "sha384" }}
|
||||
{{- end -}}
|
||||
<link rel="stylesheet" href="{{ $style.RelPermalink }}" {{ if hugo.IsProduction }}integrity="{{ $style.Data.Integrity }}"{{ end -}} crossorigin="anonymous">
|
||||
<!-- Plausible Analytics Config -->
|
||||
{{- if not .Site.IsServer }}
|
||||
{{ if and (.Site.Params.plausible.scriptURL | default "https://plausible.io") (.Site.Params.plausible.dataDomain) -}}
|
||||
{{- partialCached (printf "%s/%s" (.Site.Params.docs.pathName | default "docs") "head/plausible") . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<!-- Google Analytics v4 Config -->
|
||||
{{- if not .Site.IsServer }}
|
||||
{{- if .Site.GoogleAnalytics }}
|
||||
{{- template "_internal/google_analytics.html" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</head>
|
8
docSite/layouts/partials/docs/toc.html
Normal file
8
docSite/layouts/partials/docs/toc.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<toc>
|
||||
<div class="fw-bold text-uppercase mb-2">{{ .Title }}</div>
|
||||
{{ if eq .Site.Params.docs.scrollSpy true -}}
|
||||
{{ .TableOfContents | replaceRE "<nav id=\"TableOfContents\">" "<nav id=\"toc\">" | safeHTML }}
|
||||
{{ else -}}
|
||||
{{ .TableOfContents }}
|
||||
{{ end -}}
|
||||
</toc>
|
119
docSite/layouts/partials/docs/top-header.html
Normal file
119
docSite/layouts/partials/docs/top-header.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<!-- Top Header -->
|
||||
<div id="top-header" class="top-header d-print-none">
|
||||
<div class="header-bar d-flex justify-content-between">
|
||||
<div class="d-flex align-items-center">
|
||||
<a href='{{ relLangURL "" }}' class="logo-icon me-3" aria-label="HomePage" alt="HomePage">
|
||||
<div class="small">
|
||||
{{ with resources.Get "images/logos/mark.svg" }}
|
||||
{{ .Content | safeHTML }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="big">
|
||||
{{ with resources.Get "images/logos/logo.svg" }}
|
||||
{{ .Content | safeHTML }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</a>
|
||||
<button id="close-sidebar" class="btn btn-icon btn-soft">
|
||||
<span class="material-icons size-20 menu-icon align-middle">menu</span>
|
||||
</button>
|
||||
{{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}}
|
||||
<span><div id="docsearch"></div></span>
|
||||
{{ end }}
|
||||
{{ if or (not (isset .Site.Params.flexsearch "enabled")) (eq .Site.Params.flexsearch.enabled true) -}}
|
||||
{{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}}
|
||||
{{ else }}
|
||||
<!-- <form class="flexsearch position-relative flex-grow-1 ms-2 me-lg-2 d-none">
|
||||
<input id="flexsearch" class="form-control is-search" type="search" placeholder="{{ i18n "search_title" }}" aria-label="{{ i18n "search_title" }}" autocomplete="off">
|
||||
<div id="suggestions" class="shadow bg-white rounded d-none"></div>
|
||||
</form> -->
|
||||
<button id="flexsearch-button" class="ms-3 btn btn-soft" data-bs-toggle="collapse" data-bs-target="#FlexSearchCollapse" aria-expanded="false" aria-controls="FlexSearchCollapse">
|
||||
<span class="material-icons size-20 menu-icon align-middle">search</span>
|
||||
<span class="flexsearch-button-placeholder ms-1 me-2 d-none d-sm-block">{{ i18n "search_title" }}</span>
|
||||
<div class="d-none d-sm-block">
|
||||
<span class="flexsearch-button-keys">
|
||||
<kbd class="flexsearch-button-cmd-key">
|
||||
<svg width="44" height="15"><path d="M2.118,11.5A1.519,1.519,0,0,1,1,11.042,1.583,1.583,0,0,1,1,8.815a1.519,1.519,0,0,1,1.113-.458h.715V6.643H2.118A1.519,1.519,0,0,1,1,6.185,1.519,1.519,0,0,1,.547,5.071,1.519,1.519,0,0,1,1,3.958,1.519,1.519,0,0,1,2.118,3.5a1.519,1.519,0,0,1,1.114.458A1.519,1.519,0,0,1,3.69,5.071v.715H5.4V5.071A1.564,1.564,0,0,1,6.976,3.5,1.564,1.564,0,0,1,8.547,5.071,1.564,1.564,0,0,1,6.976,6.643H6.261V8.357h.715a1.575,1.575,0,0,1,1.113,2.685,1.583,1.583,0,0,1-2.227,0A1.519,1.519,0,0,1,5.4,9.929V9.214H3.69v.715a1.519,1.519,0,0,1-.458,1.113A1.519,1.519,0,0,1,2.118,11.5Zm0-.857a.714.714,0,0,0,.715-.714V9.214H2.118a.715.715,0,1,0,0,1.429Zm4.858,0a.715.715,0,1,0,0-1.429H6.261v.715a.714.714,0,0,0,.715.714ZM3.69,8.357H5.4V6.643H3.69ZM2.118,5.786h.715V5.071a.714.714,0,0,0-.715-.714.715.715,0,0,0-.5,1.22A.686.686,0,0,0,2.118,5.786Zm4.143,0h.715a.715.715,0,0,0,.5-1.22.715.715,0,0,0-1.22.5Z" fill="currentColor"></path><path d="M12.4,11.475H11.344l3.879-7.95h1.056Z" fill="currentColor"></path><path d="M25.073,5.384l-.864.576a2.121,2.121,0,0,0-1.786-.923,2.207,2.207,0,0,0-2.266,2.326,2.206,2.206,0,0,0,2.266,2.325,2.1,2.1,0,0,0,1.782-.918l.84.617a3.108,3.108,0,0,1-2.622,1.293,3.217,3.217,0,0,1-3.349-3.317,3.217,3.217,0,0,1,3.349-3.317A3.046,3.046,0,0,1,25.073,5.384Z" fill="currentColor"></path><path d="M30.993,5.142h-2.07v5.419H27.891V5.142h-2.07V4.164h5.172Z" fill="currentColor"></path><path d="M34.67,4.164c1.471,0,2.266.658,2.266,1.851,0,1.087-.832,1.809-2.134,1.855l2.107,2.691h-1.28L33.591,7.87H33.07v2.691H32.038v-6.4Zm-1.6.969v1.8h1.572c.832,0,1.22-.3,1.22-.918s-.411-.882-1.22-.882Z" fill="currentColor"></path><path d="M42.883,10.561H38.31v-6.4h1.033V9.583h3.54Z" fill="currentColor"></path></svg>
|
||||
</kbd>
|
||||
<kbd class="flexsearch-button-key">
|
||||
<svg width="15" height="15"><path d="M5.926,12.279H4.41L9.073,2.721H10.59Z" fill="currentColor"/></svg>
|
||||
</kbd>
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
<ul class="list-unstyled mb-0">
|
||||
{{ with $.Scratch.Get "social_list" }}
|
||||
{{ range . }}
|
||||
{{ $path := printf "images/social/%s.%s" . "svg" }}
|
||||
<li class="list-inline-item mb-0">
|
||||
<!-- change -->
|
||||
<a href="{{ if eq . `rss` }} {{ `index.xml` | absURL }} {{ else if eq . `wechat` }} {{ index site.Params.social . | absURL }} {{ else }} https://{{ . }}.com/{{ index site.Params.social . }} {{ end }}" alt="{{ . }}" rel="noopener noreferrer" target="_blank">
|
||||
<div class="btn btn-icon btn-default border-0">
|
||||
{{ with resources.Get $path }}
|
||||
{{ .Content | safeHTML }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ if eq .Site.Params.docs.darkMode true -}}
|
||||
<button id="mode" class="btn btn-icon btn-default ms-2" type="button" aria-label="Toggle user interface mode">
|
||||
<span class="toggle-dark">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="30" width="30" viewBox="0 0 48 48" fill="currentColor"><path d="M24 42q-7.5 0-12.75-5.25T6 24q0-7.5 5.25-12.75T24 6q.4 0 .85.025.45.025 1.15.075-1.8 1.6-2.8 3.95-1 2.35-1 4.95 0 4.5 3.15 7.65Q28.5 25.8 33 25.8q2.6 0 4.95-.925T41.9 22.3q.05.6.075.975Q42 23.65 42 24q0 7.5-5.25 12.75T24 42Zm0-3q5.45 0 9.5-3.375t5.05-7.925q-1.25.55-2.675.825Q34.45 28.8 33 28.8q-5.75 0-9.775-4.025T19.2 15q0-1.2.25-2.575.25-1.375.9-3.125-4.9 1.35-8.125 5.475Q9 18.9 9 24q0 6.25 4.375 10.625T24 39Zm-.2-14.85Z"/></svg>
|
||||
</span>
|
||||
<span class="toggle-light">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="30" width="30" viewBox="0 0 48 48" fill="currentColor"><path d="M24 31q2.9 0 4.95-2.05Q31 26.9 31 24q0-2.9-2.05-4.95Q26.9 17 24 17q-2.9 0-4.95 2.05Q17 21.1 17 24q0 2.9 2.05 4.95Q21.1 31 24 31Zm0 3q-4.15 0-7.075-2.925T14 24q0-4.15 2.925-7.075T24 14q4.15 0 7.075 2.925T34 24q0 4.15-2.925 7.075T24 34ZM3.5 25.5q-.65 0-1.075-.425Q2 24.65 2 24q0-.65.425-1.075Q2.85 22.5 3.5 22.5h5q.65 0 1.075.425Q10 23.35 10 24q0 .65-.425 1.075-.425.425-1.075.425Zm36 0q-.65 0-1.075-.425Q38 24.65 38 24q0-.65.425-1.075.425-.425 1.075-.425h5q.65 0 1.075.425Q46 23.35 46 24q0 .65-.425 1.075-.425.425-1.075.425ZM24 10q-.65 0-1.075-.425Q22.5 9.15 22.5 8.5v-5q0-.65.425-1.075Q23.35 2 24 2q.65 0 1.075.425.425.425.425 1.075v5q0 .65-.425 1.075Q24.65 10 24 10Zm0 36q-.65 0-1.075-.425-.425-.425-.425-1.075v-5q0-.65.425-1.075Q23.35 38 24 38q.65 0 1.075.425.425.425.425 1.075v5q0 .65-.425 1.075Q24.65 46 24 46ZM12 14.1l-2.85-2.8q-.45-.45-.425-1.075.025-.625.425-1.075.45-.45 1.075-.45t1.075.45L14.1 12q.4.45.4 1.05 0 .6-.4 1-.4.45-1.025.45-.625 0-1.075-.4Zm24.7 24.75L33.9 36q-.4-.45-.4-1.075t.45-1.025q.4-.45 1-.45t1.05.45l2.85 2.8q.45.45.425 1.075-.025.625-.425 1.075-.45.45-1.075.45t-1.075-.45ZM33.9 14.1q-.45-.45-.45-1.05 0-.6.45-1.05l2.8-2.85q.45-.45 1.075-.425.625.025 1.075.425.45.45.45 1.075t-.45 1.075L36 14.1q-.4.4-1.025.4-.625 0-1.075-.4ZM9.15 38.85q-.45-.45-.45-1.075t.45-1.075L12 33.9q.45-.45 1.05-.45.6 0 1.05.45.45.45.45 1.05 0 .6-.45 1.05l-2.8 2.85q-.45.45-1.075.425-.625-.025-1.075-.425ZM24 24Z"/></svg>
|
||||
</span>
|
||||
</button>
|
||||
{{ end -}}
|
||||
{{ if .Site.IsMultiLingual }}
|
||||
<button type="button" class="ps-2 btn btn-link btn-default" data-bs-toggle="modal" data-bs-target="#lang-selector-popup">
|
||||
{{ site.Language.Lang | upper }}
|
||||
</button>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- FlexSearch Input Start -->
|
||||
{{ if or (not (isset .Site.Params.flexsearch "enabled")) (eq .Site.Params.flexsearch.enabled true) -}}
|
||||
{{ if and (.Site.Params.docsearch.appID) (.Site.Params.docsearch.apiKey) -}}
|
||||
{{ else }}
|
||||
<div class="collapse" id="FlexSearchCollapse">
|
||||
<div class="flexsearch-container">
|
||||
<div class="flexsearch-keymap">
|
||||
<li>
|
||||
<kbd class="flexsearch-button-cmd-key"><svg width="15" height="15" aria-label="Arrow down" role="img"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2"><path d="M7.5 3.5v8M10.5 8.5l-3 3-3-3"></path></g></svg></kbd>
|
||||
<kbd class="flexsearch-button-cmd-key"><svg width="15" height="15" aria-label="Arrow up" role="img"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2"><path d="M7.5 11.5v-8M10.5 6.5l-3-3-3 3"></path></g></svg></kbd>
|
||||
<span class="flexsearch-key-label">{{ i18n "search_navigate" | default "to navigate" }}</span>
|
||||
</li>
|
||||
<li>
|
||||
<kbd class="flexsearch-button-cmd-key"><svg width="15" height="15" aria-label="Enter key" role="img"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2"><path d="M12 3.53088v3c0 1-1 2-2 2H4M7 11.53088l-3-3 3-3"></path></g></svg></kbd>
|
||||
<span class="flexsearch-key-label">{{ i18n "search_select" | default "to select" }}</span>
|
||||
</li>
|
||||
<li>
|
||||
<kbd class="flexsearch-button-cmd-key"><svg width="15" height="15" aria-label="Escape key" role="img"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2"><path d="M13.6167 8.936c-.1065.3583-.6883.962-1.4875.962-.7993 0-1.653-.9165-1.653-2.1258v-.5678c0-1.2548.7896-2.1016 1.653-2.1016.8634 0 1.3601.4778 1.4875 1.0724M9 6c-.1352-.4735-.7506-.9219-1.46-.8972-.7092.0246-1.344.57-1.344 1.2166s.4198.8812 1.3445.9805C8.465 7.3992 8.968 7.9337 9 8.5c.032.5663-.454 1.398-1.4595 1.398C6.6593 9.898 6 9 5.963 8.4851m-1.4748.5368c-.2635.5941-.8099.876-1.5443.876s-1.7073-.6248-1.7073-2.204v-.4603c0-1.0416.721-2.131 1.7073-2.131.9864 0 1.6425 1.031 1.5443 2.2492h-2.956"></path></g></svg></kbd>
|
||||
<span class="flexsearch-key-label">{{ i18n "search_close" | default "to close" }}</span>
|
||||
</li>
|
||||
</div>
|
||||
<form class="flexsearch position-relative flex-grow-1 ms-2 me-2">
|
||||
<div class="d-flex flex-row">
|
||||
<input id="flexsearch" class="form-control" type="search" placeholder="{{ i18n "search_title" }}" aria-label="{{ i18n "search_title" }}" autocomplete="off">
|
||||
<button id="hideFlexsearch" type="button" class="ms-2 btn btn-soft">
|
||||
{{ i18n "search_cancel" | default "cancel" }}
|
||||
</button>
|
||||
</div>
|
||||
<div id="suggestions" class="shadow rounded-1 d-none"></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<!-- FlexSearch Input End -->
|
||||
</div>
|
||||
<!-- Top Header -->
|
42
docSite/layouts/shortcodes/bilibili.html
Normal file
42
docSite/layouts/shortcodes/bilibili.html
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<!-- style 样式 是为了让网页上的视频框按比例显示而非固定的大小 -->
|
||||
<style type="text/css">
|
||||
.aspect-ratio {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
padding-bottom: 75%;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.aspect-ratio iframe {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="aspect-ratio">
|
||||
<iframe
|
||||
src="https://player.bilibili.com/player.html?bvid={{.Get 0 }}&page={{ if .Get 1 }}{{.Get 1}}{{ else }}1&high_quality=1&danmaku=0{{end}}"
|
||||
scrolling="no"
|
||||
border="0"
|
||||
frameborder="no"
|
||||
framespacing="0"
|
||||
allowfullscreen="true"
|
||||
>
|
||||
</iframe>
|
||||
<!-- src 中的 &high_quality=1&danmaku=0 设定了高清程度并默认屏蔽弹幕 -->
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
40
docSite/layouts/shortcodes/figure.html
Normal file
40
docSite/layouts/shortcodes/figure.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{{ if .Get "default" }}
|
||||
{{ template "_internal/shortcodes/figure.html" . }}
|
||||
{{ else }}
|
||||
{{ $url := urls.Parse (.Get "src") }}
|
||||
{{ $altText := .Get "alt" }}
|
||||
{{ $caption := .Get "caption" }}
|
||||
{{ $href := .Get "href" }}
|
||||
{{ $class := .Get "class" }}
|
||||
<figure{{ with $class }} class="{{ . }}"{{ end }}>
|
||||
{{ with $href }}<a href="{{ . }}">{{ end }}
|
||||
<img
|
||||
class="mx-auto my-0 rounded-md"
|
||||
alt="{{ $altText }}"
|
||||
{{ if .Site.Params.enableImageLazyLoading | default true }}
|
||||
loading="lazy"
|
||||
{{ end }}
|
||||
{{ if findRE "^https?" $url.Scheme }}
|
||||
src="{{ $url.String }}"
|
||||
{{ else }}
|
||||
{{ $resource := "" }}
|
||||
{{ if $.Page.Resources.GetMatch ($url.String) }}
|
||||
{{ $resource = $.Page.Resources.GetMatch ($url.String) }}
|
||||
{{ else if resources.GetMatch ($url.String) }}
|
||||
{{ $resource = resources.Get ($url.String) }}
|
||||
{{ end }}
|
||||
{{ with $resource }}
|
||||
{{ if eq .MediaType.SubType "svg" }}
|
||||
src="{{ .RelPermalink }}"
|
||||
{{ else }}
|
||||
src="{{ .RelPermalink }}"
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
src="{{ $url.String }}"
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
/>
|
||||
{{ with $href }}</a>{{ end }}
|
||||
{{ with $caption }}<figcaption style="text-align: center; margin-top: .8571429em; font-size: .875em">{{ . | markdownify }}</figcaption>{{ end }}
|
||||
</figure>
|
||||
{{ end }}
|
Reference in New Issue
Block a user