Skip to content

Commit 0a897c7

Browse files
committed
Enhance translation draft handling and add preview messages in guides
1 parent 0fed894 commit 0a897c7

File tree

6 files changed

+49
-12
lines changed

6 files changed

+49
-12
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: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
{{- $isComingSoon := and .Date (lt now .Date) (eq hugo.Environment "production") }}
2-
{{- $contentAvailable := and .Page.Content (gt (len .Page.Content) 500) (not .Params.translationDraft) }}
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+
311
<section class="my-2" style="max-width: 1200px; margin: 0 auto;">
412
<div class="row">
513
<!-- Sidebar with table of contents -->
@@ -182,9 +190,7 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
182190
</div>
183191
</header>
184192
<div class="content-body pt-3">
185-
{{- if $isComingSoon }}
186-
<div class="alert alert-warning" role="alert">{{ i18n "guide_coming_soon" . }}</div>
187-
{{ else }}
193+
188194
{{- /* Version notice for historical versions */ -}}
189195
{{ partial "components/guide/guide-version-notice.html" . }}
190196

@@ -230,6 +236,12 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
230236

231237
{{- /* Check if content is empty and provide fallback */ -}}
232238
{{- 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 -}}
233245
{{ .Content }}
234246
{{- else }}
235247
{{- /* Get the default guide content as fallback */ -}}
@@ -239,11 +251,15 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
239251
{{- if not $thisPageDefault }}
240252
{{- fmt.Errorf "thisPageDefault page not found" }}
241253
{{- end }}
242-
254+
243255
{{- if $thisPageDefault }}
244256
<div class="alert alert-info mb-4" role="alert">
245257
<i class="fa-solid fa-info-circle me-2"></i>
246258
<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+
247263
</div>
248264
<div lang="{{ $thisPageDefault.Language.Lang }}">
249265
{{ $thisPageDefault.Content }}
@@ -256,8 +272,6 @@ <h4 class="h6 text-muted mb-3 flex-shrink-0 d-none d-md-block">{{ i18n "guide_ta
256272
</div>
257273
{{- end }}
258274
{{- end }}
259-
260-
{{- end }}
261275
</div>
262276
<footer class="content-footer mt-4">
263277
<div class="back-to-home mt-3">

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)