new theme

This commit is contained in:
rustdesk
2025-06-15 02:57:17 +08:00
parent 989642a024
commit 78ae2a484c
40 changed files with 1091 additions and 243 deletions

View File

@@ -1,14 +1,4 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WCJMDEZ618"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-WCJMDEZ618');
</script>
{{ if not .Site.Params.disable_cookie }}
{{ if not .context.Site.Params.disable_cookie }}
<div class="cookie-consent">
This website uses cookies to ensure you get the best experience on our website. <a target="_blank" rel="noopener"
href="https://www.cookiesandyou.com">Learn More</a>
@@ -54,4 +44,4 @@
}
}, 2000);
</script>
{{ end }}
{{ end }}

View File

@@ -0,0 +1,12 @@
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WCJMDEZ618"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-WCJMDEZ618');
</script>
<!-- Image zoom functionality -->
<script src="{{ "js/image-zoom.js" | relURL }}" defer></script>

View File

@@ -0,0 +1 @@
<link rel="icon" href="{{ "favicon.svg" | relURL }}" type="image/svg+xml" />

View File

@@ -1,6 +0,0 @@
<a id="logo" href="/docs/{{.Site.Language.Lang}}">
<svg width="32" height="32" wversion="1.1" fill="white" viewBox="0 0 263.67 263.26" xmlns="http://www.w3.org/2000/svg" style="transform: rotateY(0deg) rotate(45deg);">
<path d="m99.158 261.8c-29.063-6.202-53.897-22.439-73.115-47.804-19.507-25.746-27.838-55.355-25.723-91.414 6.655-62.013 47.667-106.75 99.687-120.41 4.509-0.989 8.353-3.462 12.55-1.322 3.22 1.64 6.028 4.467 7.206 7.251 1.25 2.955 1.877 21.54 0.99 29.331-1.076 9.46-3.877 12.418-14.566 15.388-29.723 10.195-48.105 34.07-53.697 61.017-4.8 29.668 2.951 59.729 21.528 78.727 8.966 8.993 17.92 14.24 30.869 18.086 8.646 2.57 13.393 5.758 15.036 10.102 1.085 2.867 1.63 22.984 0.779 28.772-1.33 9.046-1.702 9.796-5.792 11.667-5.029 2.3-7.404 2.392-15.752 0.61zm50.708 0.29c-3.092-1.402-5.673-4.83-6.73-8.94-0.134-9.408-2.366-25.754 1.02-33.373 1.88-4.128 4.65-5.999 12.433-8.396 21.267-6.551 37.593-19.88 46.806-38.213 11.11-22.108 11.877-55.183 1.808-77.975-9.154-20.723-25.7-35.217-48.555-42.534-8.872-2.84-12.004-5.065-12.968-9.21-1.002-4.31-1.435-19.87-0.785-28.218 0.682-8.766 1.249-9.99 6.162-13.318 3.701-2.505 5.482-2.446 17.223 0.575 36.718 10.077 65.97 33.597 83.026 66.68 18.495 37.034 19.191 86.11 1.742 122.65-17.233 36.09-50.591 62.511-88.622 70.194-8.172 1.65-9.07 1.656-12.56 0.073z"/>
</svg>
<span>rustdesk</span>
</a>

View File

@@ -1,3 +0,0 @@
<center>
<p>Thanks for <a href="https://github.com/matcornic/hugo-theme-learn">hugo-theme-learn</a></p>
</center>

View File

@@ -0,0 +1,80 @@
{{- $page := .context -}}
{{- $changeLanguage := (T "changeLanguage") | default "Change language" -}}
{{- if hugo.IsMultilingual -}}
<div class="hx:relative">
<button
title="{{ $changeLanguage }}"
data-state="closed"
class="navbar-language-switcher hx:cursor-pointer hx:p-2 hx:text-current hx:hover:bg-gray-100 hx:dark:hover:bg-neutral-800 hx:transition-colors hx:duration-200 hx:rounded-lg hx:flex hx:items-center hx:gap-1"
type="button"
aria-label="{{ $changeLanguage }}"
>
{{- partial "utils/icon.html" (dict "name" "translate" "attributes" "height=20") -}}
{{- partial "utils/icon.html" (dict "name" "chevron-down" "attributes" "height=14 class=\"hx:transition-transform hx:duration-200 hx:ease-in-out\"") -}}
</button>
<ul
class="navbar-language-options hx:hidden hx:absolute hx:top-full hx:right-0 hx:z-20 hx:mt-1 hx:max-h-80 hx:overflow-auto hx:rounded-md hx:ring-1 hx:ring-black/5 hx:bg-white hx:py-1 hx:text-sm hx:shadow-lg hx:dark:ring-white/20 hx:dark:bg-neutral-800"
style="min-width: 140px; scrollbar-width: none; -ms-overflow-style: none;"
>
{{ range site.Languages }}
{{ $link := partial "utils/lang-link" (dict "lang" .Lang "context" $page) }}
<li class="hx:flex hx:flex-col">
<a
href="{{ $link }}"
class="hx:text-gray-800 hx:dark:text-gray-100 hx:hover:bg-primary-50 hx:hover:text-primary-600 hx:hover:dark:bg-primary-500/10 hx:hover:dark:text-primary-600 hx:relative hx:cursor-pointer hx:whitespace-nowrap hx:py-1.5 hx:transition-colors hx:ltr:pl-3 hx:ltr:pr-9 hx:rtl:pr-3 hx:rtl:pl-9"
>
{{- .LanguageName -}}
{{- if eq .LanguageName site.Language.LanguageName -}}
<span class="hx:absolute hx:inset-y-0 hx:flex hx:items-center hx:ltr:right-3 hx:rtl:left-3">
{{- partial "utils/icon.html" (dict "name" "check" "attributes" "height=1em width=1em") -}}
</span>
{{- end -}}
</a>
</li>
{{ end -}}
</ul>
</div>
<style>
.navbar-language-options::-webkit-scrollbar {
display: none;
}
</style>
<script>
(function() {
const switcher = document.querySelector('.navbar-language-switcher');
const options = document.querySelector('.navbar-language-options');
if (switcher && options) {
const chevron = switcher.querySelector('svg:last-child');
switcher.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
const isOpen = switcher.dataset.state === 'open';
switcher.dataset.state = isOpen ? 'closed' : 'open';
if (isOpen) {
options.classList.add('hx:hidden');
if (chevron) chevron.style.transform = 'rotate(0deg)';
} else {
options.classList.remove('hx:hidden');
if (chevron) chevron.style.transform = 'rotate(180deg)';
}
});
// Close when clicking outside
document.addEventListener('click', function(e) {
if (!switcher.contains(e.target) && !options.contains(e.target)) {
switcher.dataset.state = 'closed';
options.classList.add('hx:hidden');
if (chevron) chevron.style.transform = 'rotate(0deg)';
}
});
}
})();
</script>
{{- end -}}

View File

@@ -0,0 +1,123 @@
{{- $logoPath := .Site.Params.navbar.logo.path | default "images/logo.svg" -}}
{{- $logoLink := .Site.Params.navbar.logo.link | default .Site.Home.RelPermalink -}}
{{- $logoWidth := .Site.Params.navbar.logo.width | default "20" -}}
{{- $logoHeight := .Site.Params.navbar.logo.height | default "20" -}}
{{- $logoDarkPath := .Site.Params.navbar.logo.dark | default $logoPath -}}
{{- $navWidth := "hx:max-w-[90rem]" -}}
{{- with .Site.Params.navbar.width -}}
{{ if eq . "normal" -}}
{{ $navWidth = "hx:max-w-screen-xl" -}}
{{ else if eq . "full" -}}
{{ $navWidth = "max-w-full" -}}
{{ end -}}
{{- end -}}
<div class="nav-container hx:sticky hx:top-0 hx:z-20 hx:w-full hx:bg-transparent hx:print:hidden">
<div
class="nav-container-blur hx:pointer-events-none hx:absolute hx:z-[-1] hx:h-full hx:w-full hx:bg-white hx:dark:bg-dark hx:shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] hx:contrast-more:shadow-[0_0_0_1px_#000] hx:dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] hx:contrast-more:dark:shadow-[0_0_0_1px_#fff]"
></div>
<nav class="hextra-max-navbar-width hx:mx-auto hx:flex hx:items-center hx:justify-end hx:gap-2 hx:h-16 hx:px-6">
<a class="hx:flex hx:items-center hx:hover:opacity-75 hx:ltr:mr-auto hx:rtl:ml-auto" href="{{ $logoLink }}">
{{- $displayTitle := (.Site.Params.navbar.displayTitle | default true) }}
{{- if (.Site.Params.navbar.displayLogo | default true) }}
<img class="hx:mr-2 hx:block hx:dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ cond $displayTitle `Logo` .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
<img class="hx:mr-2 hx:hidden hx:dark:block" src="{{ $logoDarkPath | relURL }}" alt="{{ cond $displayTitle `Dark Logo` .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
{{- end }}
{{- if $displayTitle }}
<span class="hx:mr-2 hx:font-extrabold hx:inline hx:select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span>
{{- end }}
</a>
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
{{- if eq .Params.type "search" -}}
{{/* Add language switch and theme toggle before search */}}
{{- $displayThemeToggle := (site.Params.theme.displayToggle | default true) -}}
{{- if hugo.IsMultilingual -}}
{{- partial "navbar-language-switch" (dict "context" $currentPage) -}}
{{- end -}}
{{- if $displayThemeToggle -}}
{{- partial "theme-toggle.html" (dict "hideLabel" true) -}}
{{- end -}}
{{- partial "search.html" (dict "params" .Params) -}}
{{- else -}}
{{- $link := .URL -}}
{{- $external := strings.HasPrefix $link "http" -}}
{{- with .PageRef -}}
{{- if hasPrefix . "/" -}}
{{- $link = relLangURL (strings.TrimPrefix "/" .) -}}
{{- end -}}
{{- end -}}
{{/* Display icon menu item */}}
{{- if .Params.icon -}}
{{- $rel := cond (eq .Params.icon "mastodon") "noreferrer me" "noreferrer" }}
<a class="hx:p-2 hx:text-current hx:hover:bg-gray-100 hx:dark:hover:bg-neutral-800 hx:transition-colors hx:duration-200 hx:rounded-lg hx:hidden hx:md:inline-block" {{ if $external }}target="_blank" rel="{{ $rel }}"{{ end }} href="{{ $link }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=20") -}}
<span class="hx:sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
</a>
{{- else -}}
{{- $active := or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) -}}
{{- $activeClass := cond $active "hx:font-medium" "hx:text-gray-600 hx:hover:text-gray-800 hx:dark:text-gray-400 hx:dark:hover:text-gray-200" -}}
{{- if .HasChildren -}}
{{/* Dropdown menu for items with children */}}
<div class="hx:relative hx:hidden hx:md:inline-block">
<button
title="{{ or (T .Identifier) .Name | safeHTML }}"
data-state="closed"
class="hextra-nav-menu-toggle hx:cursor-pointer hx:text-sm hx:contrast-more:text-gray-700 hx:contrast-more:dark:text-gray-100 hx:relative hx:-ml-2 hx:whitespace-nowrap hx:p-2 hx:flex hx:items-center hx:gap-1 {{ $activeClass }}"
type="button"
aria-label="{{ or (T .Identifier) .Name | safeHTML }}"
>
<span class="hx:text-center">{{ or (T .Identifier) .Name | safeHTML }}</span>
{{- partial "utils/icon.html" (dict "name" "chevron-down" "attributes" "height=12 class=\"hx:transition-transform hx:duration-200 hx:ease-in-out\"") -}}
</button>
<ul
class="hextra-nav-menu-items hx:hidden hx:z-20 hx:max-h-64 hx:overflow-auto hx:rounded-md hx:ring-1 hx:ring-black/5 hx:bg-white hx:py-1 hx:text-sm hx:shadow-lg hx:dark:ring-white/20 hx:dark:bg-neutral-800"
style="min-width: 100px;"
>
{{ range .Children }}
{{- $link := .URL -}}
{{- $external := strings.HasPrefix $link "http" -}}
{{- with .PageRef -}}
{{- if hasPrefix . "/" -}}
{{- $link = relLangURL (strings.TrimPrefix "/" .) -}}
{{- end -}}
{{- end -}}
<li class="hextra-nav-menu-item hx:flex hx:flex-col">
<a
href="{{ $link }}"
{{ if $external }}target="_blank" rel="noreferrer"{{ end }}
class="hx:text-gray-600 hx:hover:text-gray-800 hx:dark:text-gray-400 hx:dark:hover:text-gray-200 hx:relative hx:cursor-pointer hx:whitespace-nowrap hx:py-1.5 hx:transition-colors hx:ltr:pl-3 hx:ltr:pr-9 hx:rtl:pr-3 hx:rtl:pl-9"
>
{{- or (T .Identifier) .Name | safeHTML -}}
</a>
</li>
{{- end -}}
</ul>
</div>
{{- else -}}
{{/* Regular menu item without children */}}
<a
title="{{ or (T .Identifier) .Name | safeHTML }}"
href="{{ $link }}"
{{ if $external }}target="_blank" rel="noreferrer"{{ end }}
class="hx:text-sm hx:contrast-more:text-gray-700 hx:contrast-more:dark:text-gray-100 hx:relative hx:-ml-2 hx:hidden hx:whitespace-nowrap hx:p-2 hx:md:inline-block {{ $activeClass }}"
>
<span class="hx:text-center">{{ or (T .Identifier) .Name | safeHTML }}</span>
</a>
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
<button type="button" aria-label="Menu" class="hamburger-menu hx:cursor-pointer hx:-mr-2 hx:rounded-sm hx:p-2 hx:active:bg-gray-400/20 hx:md:hidden">
{{- partial "utils/icon.html" (dict "name" "hamburger-menu" "attributes" "height=24") -}}
</button>
</nav>
</div>