|
219 | 219 | {{ end }} |
220 | 220 | {{ end }} |
221 | 221 | {{ 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 | + |
223 | 231 | {{ $page := dict |
224 | 232 | "kind" "section" |
225 | 233 | "path" (printf "committees/%s" $slug) |
|
231 | 239 | "contact" .contact |
232 | 240 | "dir" .dir |
233 | 241 | "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 |
235 | 243 | ) |
236 | 244 | "content" (dict |
237 | 245 | "mediaType" "text/markdown" |
238 | 246 | "value" $readmeContent |
239 | 247 | ) |
240 | 248 | }} |
241 | 249 | {{ $.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 }} |
272 | 278 | {{ 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 -}} |
275 | 285 | {{- end -}} |
276 | | - {{- end -}} |
| 286 | + {{ end }} |
277 | 287 | {{- end -}} |
278 | 288 | {{- end -}} |
279 | 289 | {{- else -}} |
|
0 commit comments