Skip to content

Commit b0f96ec

Browse files
authored
Merge pull request #8 from nkdAgility/add-content-available
Add content available
2 parents 1504d97 + 0a897c7 commit b0f96ec

File tree

10 files changed

+69
-17
lines changed

10 files changed

+69
-17
lines changed

module/hugo.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ params:
2626
siteProdUrl: "https://hugoguide.org"
2727
supportEmail: "[email protected]"
2828
githubUrl: "https://github.com/nkdAgility/HugoGuides"
29-
previewSiteUrl: https://preview.hugoguides.org/
30-
productionSiteUrl: https://hugoguides.org/
29+
previewSiteUrl: https://preview.hugoguides.org
30+
productionSiteUrl: https://hugoguides.org
3131
brand:
3232
bg_colour: "#135289"
3333
AzureSitesConfig: "#{Guides_AzureSitesConfig}#"

module/layouts/_partials/components/guide/render-guide.html

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
{{- $isComingSoon := and .Date (lt now .Date) (eq hugo.Environment "production") }}
1+
{{- $isTranslationDraft := and .Params.translationDraft (eq hugo.Environment "production") }}
2+
{{- $isTranslationPreview := .Params.translationDraft}}
3+
{{- if $isTranslationDraft }}
4+
{{- warnf "This guide is a translation draft and may not be fully complete or accurate." }}
5+
{{- end }}
6+
7+
{{- /* Check if content is available */ -}}
8+
{{- $contentAvailable := and .Page.Content (gt (len .Page.Content) 500) (not $isTranslationDraft) }}
9+
10+
211
<section class="my-2" style="max-width: 1200px; margin: 0 auto;">
312
<div class="row">
413
<!-- Sidebar with table of contents -->
@@ -44,7 +53,7 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
4453

4554
<!-- Collapsible TOC content -->
4655
<div class="collapse d-md-block overflow-auto flex-grow-1" id="tocCollapse">
47-
{{- if and .Page.Content (gt (len .Page.Content) 100) }}
56+
{{- if $contentAvailable }}
4857
{{ .Page.TableOfContents }}
4958
{{ else }}
5059
{{- /* Get the default guide content as fallback */ -}}
@@ -67,7 +76,8 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
6776
<!-- Main content area -->
6877
<main class="col-md-9">
6978
<div class="content-wrapper px-3">
70-
<article class="content-details">
79+
<article class="content-details" nkda-data-contentavailable="{{ $contentAvailable }}">
80+
{{- /* Header with title, date, and download buttons */ -}}
7181
<header class="content-header">
7282
<div class="row mb-2">
7383
<div class="col-12 col-md-6"><h2 class="content-title mb-0">{{ .Title }}</h2></div>
@@ -180,9 +190,7 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
180190
</div>
181191
</header>
182192
<div class="content-body pt-3">
183-
{{- if $isComingSoon }}
184-
<div class="alert alert-warning" role="alert">{{ i18n "guide_coming_soon" . }}</div>
185-
{{ else }}
193+
186194
{{- /* Version notice for historical versions */ -}}
187195
{{ partial "components/guide/guide-version-notice.html" . }}
188196

@@ -227,7 +235,13 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
227235
{{- end }}
228236

229237
{{- /* Check if content is empty and provide fallback */ -}}
230-
{{- if .Content }}
238+
{{- if $contentAvailable }}
239+
{{- if $isTranslationPreview }}
240+
<div class="alert alert-warning mb-4" role="alert">
241+
<i class="fa-solid fa-exclamation-triangle me-2"></i>
242+
<strong>{{ i18n "guide_translation_preview_note" . }}</strong> {{ i18n "guide_translation_preview_message" . | markdownify }}
243+
</div>
244+
{{- end -}}
231245
{{ .Content }}
232246
{{- else }}
233247
{{- /* Get the default guide content as fallback */ -}}
@@ -237,11 +251,15 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
237251
{{- if not $thisPageDefault }}
238252
{{- fmt.Errorf "thisPageDefault page not found" }}
239253
{{- end }}
240-
254+
241255
{{- if $thisPageDefault }}
242256
<div class="alert alert-info mb-4" role="alert">
243257
<i class="fa-solid fa-info-circle me-2"></i>
244258
<strong>{{ i18n "guide_content_unavailable_note" . }}</strong> {{ i18n "guide_content_unavailable_message" (dict "Language" .Site.Language.LanguageName) }}
259+
{{- if $isTranslationPreview }}<br />
260+
<a href="{{ .Site.Params.previewSiteUrl }}{{ .RelPermalink }}" target="_blank" class="alert-link">{{ i18n "guide_preview_link" . }}</a>
261+
{{- end}}
262+
245263
</div>
246264
<div lang="{{ $thisPageDefault.Language.Lang }}">
247265
{{ $thisPageDefault.Content }}
@@ -254,8 +272,6 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
254272
</div>
255273
{{- end }}
256274
{{- end }}
257-
258-
{{- end }}
259275
</div>
260276
<footer class="content-footer mt-4">
261277
<div class="back-to-home mt-3">

module/layouts/baseof.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,18 @@
9292
{{/* Additional Meta Tags */}}
9393
<meta name="giscus:backlink" content="{{ .Site.Params.siteProdUrl }}{{ .RelPermalink }}" />
9494
<meta name="license" content="© {{ now.Format "2006" }} {{ .Site.Title }}." />
95+
96+
{{- $mainCss := resources.Get "css/style.css" -}}
97+
{{ if $mainCss -}}
98+
<link rel="stylesheet" href="{{ $mainCss.RelPermalink }}" />
99+
{{- end -}}
100+
{{- $langCode := .Site.Language.LanguageCode | default "en" -}}
101+
{{- $langCssPath := printf "css/style.%s.css" $langCode -}}
102+
{{- $langCss := resources.Get $langCssPath -}}
103+
{{ if $langCss }}
104+
<link rel="stylesheet" href="{{ $langCss.RelPermalink }}" />
105+
{{- end }}
95106
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous" />
96-
<link rel="stylesheet" href="/css/style.css" />
97107
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-j1CDi7MgGQ12Z7Qab0qlWQ/Qqz24Gc6BM0thvEMVjHnfYGF0rmFCozFSxQBxwHKO" crossorigin="anonymous"></script>
98108
<script src="https://kit.fontawesome.com/3e6b2f4808.js" crossorigin="anonymous"></script>
99109

@@ -261,6 +271,9 @@
261271
return new bootstrap.Tooltip(tooltipTriggerEl);
262272
});
263273
</script>
264-
<script src="/js/submenu.js"></script>
274+
{{- $submenuJs := resources.Get "js/submenu.js" -}}
275+
{{- if $submenuJs -}}
276+
<script src="{{ $submenuJs.RelPermalink }}"></script>
277+
{{- end -}}
265278
</body>
266279
</html>

site/content/Guide1/2020.12/index.min.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ lang: min
1717
mainfont: "Times New Banana"
1818
sansfont: "Ari-Banana"
1919
monofont: "Courier Peel"
20-
20+
translationDraft: true
2121
sitemap:
2222
priority: 0.6
2323
---

site/hugo.production.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Environment: "production"
2+
minifyOutput: true
3+
4+
buildDrafts: true
5+
buildFuture: true

site/hugo.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ params:
4141
siteProdUrl: "https://hugoguide.org"
4242
supportEmail: "[email protected]"
4343
githubUrl: "https://github.com/nkdAgility/HugoGuides"
44-
previewSiteUrl: https://preview.hugoguides.org/
45-
productionSiteUrl: https://hugoguides.org/
44+
previewSiteUrl: https://preview.hugoguides.org
45+
productionSiteUrl: https://hugoguides.org
4646
brand:
4747
bg_colour: "#135289"
4848
AzureSitesConfig: "#{Guides_AzureSitesConfig}#"

site/i18n/en.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,15 @@
282282
- id: guide_coming_label
283283
translation: "Coming:"
284284

285+
- id: guide_translation_preview_note
286+
translation: "Translation Preview:"
287+
288+
- id: guide_translation_preview_message
289+
translation: "This guide is a translation preview and may not be fully complete or accurate. Please help us review and improve it, join the discussion."
290+
291+
- id: guide_preview_link
292+
translation: "Help us review this translation"
293+
285294
- id: guide_updated_label
286295
translation: "Updated:"
287296

site/i18n/min.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
- id: read_online_button
1515
translation: "Ready Ready"
1616

17+
- id: guide_translation_preview_note
18+
translation: "Banana Translation Peek:"
19+
20+
- id: guide_translation_preview_message
21+
translation: "Dis guide iz banana peek-a-boo, no finish-finish. You help? Join da blabla!"
22+
23+
- id: guide_preview_link
24+
translation: "Help us review this translation"
25+
1726
- id: translations_title
1827
translation: "Banana Talkies"
1928

0 commit comments

Comments
 (0)