-
-
-
- {{ $resultsSlice := first 12 $results }}
- {{ range $index, $courseItem := $resultsSlice }}
- {{- if $courseItem.url_path -}}
- {{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) "/" $courseItem.url_path "/data.json") "" -}}
- {{ with resources.GetRemote $url }}
- {{ with .Err }}
- {{ errorf "Failed to fetch new course info from %v with error %v" $url . }}
+ {{ with .Value }}
+ {{ $results := (. | unmarshal).results }}
+ {{ if $results }}
+ {{ $breakdowns := (dict "xs-sm" (dict "size" 1 "class" "d-flex d-md-none") "md" (dict "size" 2 "class" "d-none d-md-flex d-lg-none") "lg" (dict "size" 3 "class" "d-none d-lg-flex d-xl-none") "xl" (dict "size" 4 "class" "d-none d-xl-flex")) }}
+
+ {{ range $breakpoint, $carouselInfo := $breakdowns }}
+ {{ $itemsInCarousel := index $carouselInfo "size" }}
+ {{ $breakpointVisibilityClass := index $carouselInfo "class" }}
+ {{ $isMobile := (eq $itemsInCarousel 1) }}
+ {{ $carouselId := (printf "new-course-carousel-%v" $breakpoint) }}
+
+
+
+
+ {{ $resultsSlice := first 12 $results }}
+ {{ range $index, $courseItem := $resultsSlice }}
+ {{- if $courseItem.url_path -}}
+ {{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) "/" $courseItem.url_path "/data.json") "" -}}
+ {{ with try (resources.GetRemote $url) }}
+ {{ with .Err }}
+ {{ errorf "Failed to fetch new course info from %v with error %v" $url . }}
+ {{ else with .Value }}
+ {{- $courseData := . | unmarshal -}}
+ {{ partial "course_carousel_card.html" (dict "itemsInCarousel" $itemsInCarousel "courseData" $courseData "index" $index "urlPath" $courseItem.url_path "numCourses" (len $resultsSlice))}}
+ {{ end }}
{{ else }}
- {{- $courseData := . | unmarshal -}}
- {{ partial "course_carousel_card.html" (dict "itemsInCarousel" $itemsInCarousel "courseData" $courseData "index" $index "urlPath" $courseItem.url_path "numCourses" (len $resultsSlice))}}
+ {{ errorf "Failed to fetch new course info from %v" $url }}
{{ end }}
- {{ else }}
- {{ errorf "Failed to fetch new course info from %v" $url }}
- {{ end }}
- {{- end -}}
- {{ end }}
+ {{- end -}}
+ {{ end }}
+
-
+ {{ end }}
+ {{ else }}
+ No new courses found
{{ end }}
- {{ else }}
- No new courses found
{{ end }}
{{ end }}
{{ else }}
diff --git a/www/layouts/partials/ocw_news.html b/www/layouts/partials/ocw_news.html
index 4ab27eb8f..8dd916a70 100644
--- a/www/layouts/partials/ocw_news.html
+++ b/www/layouts/partials/ocw_news.html
@@ -2,11 +2,11 @@
{{ $studioBaseUrl := partial "ocw_studio_base_url.html" }}
{{ if $studioBaseUrl }}
{{- $url := (print (strings.TrimSuffix "/" $studioBaseUrl) "/api/news/") -}}
- {{ with resources.GetRemote $url }}
+ {{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ $errorMessage := printf "OCW News on %v failed to fetch %v with error: %v" site.BaseURL $url . }}
{{ partial "sentry_capture_message.html" $errorMessage }}
- {{ else }}
+ {{ else with .Value }}
{{ $items := (. | unmarshal).items }}
{{ if $items }}
{{ $breakdowns := (dict "xs-sm" (dict "size" 1 "class" "d-flex d-lg-none") )}}
diff --git a/www/layouts/resource_collections/single.html b/www/layouts/resource_collections/single.html
index cc8f9bcf4..0edf049ae 100644
--- a/www/layouts/resource_collections/single.html
+++ b/www/layouts/resource_collections/single.html
@@ -24,11 +24,11 @@
{{- $urlPath := index . 1 -}}
{{- if not (isset $contentMap $urlPath) -}}
{{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) "/" $urlPath "/content_map.json") "" -}}
- {{- with resources.GetRemote $url -}}
+ {{- with try (resources.GetRemote $url) -}}
{{ with .Err }}
{{- $errorMessage := printf "Failed to fetch resource collections on %v via %v with error: %v" site.BaseURL $url . -}}
{{- partial "sentry_capture_message.html" $errorMessage -}}
- {{ else }}
+ {{ else with .Value }}
{{- $mapData := . | unmarshal -}}
{{- $mapData = merge $mapData (dict "url_path" $urlPath) -}}
{{- $contentMap = dict $urlPath $mapData | merge $contentMap -}}
@@ -40,11 +40,11 @@
{{- end -}}
{{- if not (isset $courseJSONMap $urlPath) -}}
{{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) "/" $urlPath "/data.json") "" -}}
- {{- with resources.GetRemote $url -}}
+ {{- with try (resources.GetRemote $url) -}}
{{ with .Err }}
{{- $errorMessage := printf "Failed to fetch resource collections on %v via %v with error: %v" site.BaseURL $url . -}}
{{- partial "sentry_capture_message.html" $errorMessage -}}
- {{ else }}
+ {{ else with .Value }}
{{- $data := . | unmarshal -}}
{{- $data = merge $data (dict "url_path" $urlPath) -}}
{{- $courseJSONMap = merge $courseJSONMap (dict $urlPath $data) -}}
@@ -56,11 +56,11 @@
{{- end -}}
{{- $courseJSONRelpath := index (index $contentMap $urlPath) $itemUUID -}}
{{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) $courseJSONRelpath) "" -}}
- {{- with resources.GetRemote $url -}}
+ {{- with try (resources.GetRemote $url) -}}
{{ with .Err }}
{{- $errorMessage := printf "Failed to fetch resource collections on %v via %v with error: %v" site.BaseURL $url . -}}
{{- partial "sentry_capture_message.html" $errorMessage -}}
- {{ else }}
+ {{ else with .Value}}
{{- $resourceJSON := . | unmarshal -}}
{{- $resourceJSONMap = dict $itemUUID $resourceJSON | merge $resourceJSONMap -}}
{{- $resourceURLMap = dict $itemUUID $url | merge $resourceURLMap -}}
@@ -75,4 +75,4 @@
window.resourceCollectionData = JSON.parse("{{- $resourceCollectionData | jsonify -}}");
-{{ end }}
\ No newline at end of file
+{{ end }}
diff --git a/www/layouts/sitemap.xml b/www/layouts/sitemap.xml
index 6a8b3f3b2..b45f97fe2 100644
--- a/www/layouts/sitemap.xml
+++ b/www/layouts/sitemap.xml
@@ -10,20 +10,26 @@
{{- if and $studioBaseUrl (ne $apiBearerToken "") -}}
{{- $apiUrl := printf "%v/api/publish?%v" (strings.TrimSuffix "/" $studioBaseUrl) $queryString -}}
{{- $apiHeaders := dict "headers" (dict "Authorization" (printf "Bearer %v" $apiBearerToken)) -}}
- {{- $coursesJson := resources.GetRemote $apiUrl $apiHeaders -}}
- {{- with transform.Unmarshal $coursesJson -}}
- {{- $sites := .sites -}}
- {{- if $sites -}}
- {{ range $index, $courseItem := $sites }}
- {{- $path := strings.TrimPrefix "/" (strings.TrimSuffix "/" $courseItem.base_url) -}}
- {{- if not (eq $path "") -}}
- {{- $url := printf "https://%v/%v/sitemap.xml" $sitemapDomain $path -}}
-
- {{ $url }}
-
+ {{- with try (resources.GetRemote $apiUrl $apiHeaders) -}}
+ {{- with .Err -}}
+ {{ errorf "Failed to fetch sitemap from studio: %v" . }}
+ {{- end -}}
+ {{- with .Value -}}
+ {{- with transform.Unmarshal . -}}
+ {{- $sites := .sites -}}
+ {{- if $sites -}}
+ {{ range $index, $courseItem := $sites }}
+ {{- $path := strings.TrimPrefix "/" (strings.TrimSuffix "/" $courseItem.base_url) -}}
+ {{- if not (eq $path "") -}}
+ {{- $url := printf "https://%v/%v/sitemap.xml" $sitemapDomain $path -}}
+
+ {{ $url }}
+
+ {{- end -}}
+ {{ end }}
{{- end -}}
- {{ end }}
+ {{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
-
\ No newline at end of file
+
diff --git a/yarn.lock b/yarn.lock
index ea7698866..35812b1cc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -8096,15 +8096,15 @@ __metadata:
languageName: node
linkType: hard
-"hugo-bin-extended@npm:^0.139.0":
- version: 0.139.4
- resolution: "hugo-bin-extended@npm:0.139.4"
+"hugo-bin-extended@npm:^0.141.0":
+ version: 0.141.0
+ resolution: "hugo-bin-extended@npm:0.141.0"
dependencies:
"@xhmikosr/bin-wrapper": ^13.0.5
package-config: ^5.0.0
bin:
hugo: bin/cli.js
- checksum: 64919c80a22663c85ab0650522785066c077eff06a3e2dbaf027908e42448005de0649b41140fdb91fa0ff29fd32ea5d06772764cef3b10e3e8534091d49e424
+ checksum: 4885b9e79e88acc89123bad47c24a8b7f30ae9393c687b9dbecedc6fe912a525fe535eddc55aeca9790ff0cda58f9e1e87f9f8017b37743931e6fc95eda74919
languageName: node
linkType: hard
@@ -11277,7 +11277,7 @@ __metadata:
file-loader: ^5.0.2
fuse.js: ^6.6.2
history: ^5.3.0
- hugo-bin-extended: ^0.139.0
+ hugo-bin-extended: ^0.141.0
imports-loader: ^0.8.0
inquirer: ^12.0.0
isomorphic-fetch: ^3.0.0