Skip to content

Commit 503a071

Browse files
authored
Merge pull request #733 from Prajyot-Parab/master
fix: netlify prod build failure
2 parents 78d963f + f57122c commit 503a071

2 files changed

Lines changed: 51 additions & 35 deletions

File tree

content/en/community/community-groups/_content.gotmpl

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,15 @@
219219
{{ end }}
220220
{{ end }}
221221
{{ end }}
222-
222+
{{ $charterLink := .charter_link }}
223+
{{ $remoteCharterUrl := "" }}
224+
{{ if $charterLink }}
225+
{{ $remoteCharterUrl = printf "%s%s/%s" $githubBaseUrl $dir $charterLink }}
226+
{{ if hasPrefix $charterLink "http" }}
227+
{{ $remoteCharterUrl = $charterLink }}
228+
{{ end }}
229+
{{ end }}
230+
223231
{{ $page := dict
224232
"kind" "section"
225233
"path" (printf "committees/%s" $slug)
@@ -231,49 +239,51 @@
231239
"contact" .contact
232240
"dir" .dir
233241
"remote_readme_url" (printf "%s%s/README.md" $githubBaseUrl $dir)
234-
"remote_charter_url" (printf "%s%s/charter.md" $githubBaseUrl $dir)
242+
"remote_charter_url" $remoteCharterUrl
235243
)
236244
"content" (dict
237245
"mediaType" "text/markdown"
238246
"value" $readmeContent
239247
)
240248
}}
241249
{{ $.AddPage $page }}
242-
243-
{{/* Fetch Charter Content */}}
244-
{{ $charterUrl := printf "%s%s/charter.md" $rawBaseUrl $dir }}
245-
{{ $charterOpts := merge $globalOpts (dict "key" (printf "charter-%s" $dir)) }}
246-
{{ with try (resources.GetRemote $charterUrl $charterOpts) }}
247-
{{ with .Err }}
248-
{{ if eq hugo.Environment "production" }}
249-
{{ errorf "Unable to load charter for %s: %s" $dir .Err }}
250-
{{ else }}
251-
{{ warnf "Unable to load charter for %s: %s" $dir .Err }}
252-
{{ end }}
253-
{{ else with .Value }}
254-
{{ $charterContent := replace .Content "\u200b" "" }}
255-
{{ $charterPage := dict
256-
"kind" "page"
257-
"path" (printf "committees/%s/charter" $slug)
258-
"title" (printf "%s Charter" $name)
259-
"params" (dict
260-
"remote_charter_url" (printf "%s%s/charter.md" $githubBaseUrl $dir)
261-
"hide_summary" true
262-
"toc_hide" true
263-
)
264-
"content" (dict "mediaType" "text/markdown"
265-
"value" $charterContent
266-
)
267-
}}
268-
{{ $.AddPage $charterPage }}
269-
{{ else }}
270-
{{ if eq hugo.Environment "production" }}
271-
{{ errorf "Unable to load charter for %s" $dir }}
250+
251+
{{ if and $charterLink (not (hasPrefix $charterLink "http")) }}
252+
{{ $charterUrl := printf "%s%s/%s" $rawBaseUrl $dir $charterLink }}
253+
{{ $charterOpts := merge $globalOpts (dict "key" (printf "charter-%s" $dir)) }}
254+
{{ with try (resources.GetRemote $charterUrl $charterOpts) }}
255+
{{ with .Err }}
256+
{{ if eq hugo.Environment "production" }}
257+
{{ errorf "Unable to load charter for %s: %s" $dir .Err }}
258+
{{ else }}
259+
{{ warnf "Unable to load charter for %s: %s" $dir .Err }}
260+
{{ end }}
261+
{{ else with .Value }}
262+
{{ $charterContent := replace .Content "\u200b" "" }}
263+
{{ $charterPage := dict
264+
"kind" "page"
265+
"path" (printf "committees/%s/charter" $slug)
266+
"title" (printf "%s Charter" $name)
267+
"params" (dict
268+
"remote_charter_url" (printf "%s%s/%s" $githubBaseUrl $dir $charterLink)
269+
"hide_summary" true
270+
"toc_hide" true
271+
)
272+
"content" (dict
273+
"mediaType" "text/markdown"
274+
"value" $charterContent
275+
)
276+
}}
277+
{{ $.AddPage $charterPage }}
272278
{{ else }}
273-
{{ warnf "Unable to load charter for %s" $dir }}
274-
{{ end }}
279+
{{ if eq hugo.Environment "production" }}
280+
{{ errorf "Unable to load charter for %s" $dir }}
281+
{{ else }}
282+
{{ warnf "Unable to load charter for %s" $dir }}
283+
{{ end }}
284+
{{- end -}}
275285
{{- end -}}
276-
{{- end -}}
286+
{{ end }}
277287
{{- end -}}
278288
{{- end -}}
279289
{{- else -}}

hugo.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ caches:
4646
dir: ':cacheDir/modules'
4747
maxAge: -1
4848

49+
# Use npm-installed copies of Docsy's Hugo Module deps so Hugo skips `go get`
50+
# at build time. The `go get` walks go.mod's transitive imports and fails
51+
# wherever the dependency is absent (e.g. Netlify).
52+
module:
53+
replacements: "github.com/twbs/bootstrap -> bootstrap, github.com/FortAwesome/Font-Awesome -> @fortawesome/fontawesome-free"
54+
4955
# Language configuration
5056
languages:
5157
en:

0 commit comments

Comments
 (0)