diff --git a/RELEASE.rst b/RELEASE.rst index dd5319845..827500ed9 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -1,6 +1,12 @@ Release Notes ============= +Version 1.92.0 +-------------- + +- Update og:image tag to use fully-qualified URL (#1177) +- offline search for mirror drives (#1175) + Version 1.91.0 (Released June 13, 2023) -------------- diff --git a/base-theme/layouts/partials/extra_metadata.html b/base-theme/layouts/partials/extra_metadata.html index 780f99cc8..0959cde43 100644 --- a/base-theme/layouts/partials/extra_metadata.html +++ b/base-theme/layouts/partials/extra_metadata.html @@ -1,5 +1,6 @@ {{ $context := .context }} {{ $imageData := partial "course-image-url.html" $context }} -{{ $courseImageUrl := index $imageData 0 }} - - +{{ $courseImageMetadata := index $imageData 1 }} +{{- $sitemapDomain := partial "sitemap_domain.html" -}} +{{- $absCourseImage := printf "https://%s%s" $sitemapDomain $courseImageMetadata.Params.file -}} + \ No newline at end of file diff --git a/base-theme/layouts/partials/header.html b/base-theme/layouts/partials/header.html index d754fcc7a..63aee0339 100644 --- a/base-theme/layouts/partials/header.html +++ b/base-theme/layouts/partials/header.html @@ -1,5 +1,5 @@ -{{ $siteRootUrl := partial "site_root_url.html" "/" }} +{{ $homeUrl := partial "home_url.html" }} {{ $giveNowUrl := "https://giving.mit.edu/give/to/ocw/?utm_source=ocw&utm_medium=homepage_banner&utm_campaign=nextgen_home" }} {{ $aboutUrl := partial "site_root_url.html" "/about" }} {{ $zenDeskUrl := "https://mitocw.zendesk.com/hc/en-us" }} @@ -18,7 +18,7 @@ menu
- + MIT OpenCourseWare
@@ -47,7 +47,7 @@
diff --git a/base-theme/layouts/partials/home_url.html b/base-theme/layouts/partials/home_url.html new file mode 100644 index 000000000..878380da4 --- /dev/null +++ b/base-theme/layouts/partials/home_url.html @@ -0,0 +1,2 @@ +{{ $siteRootUrl := partial "site_root_url.html" "/" }} +{{ return $siteRootUrl }} \ No newline at end of file diff --git a/env.ts b/env.ts index 3b60fc299..2f9477299 100644 --- a/env.ts +++ b/env.ts @@ -54,8 +54,9 @@ const envSchema = { OCW_TEST_COURSE: envalid.str({ devDefault: "9.40-spring-2018" }), - RESOURCE_BASE_URL: envalid.url({ - desc: "Base URL with which to prefix resource paths in hugo's output.", + RESOURCE_BASE_URL: envalid.str({ + // str, not url, to allow for "" + desc: "Base URL with which to prefix resource paths in Hugo's output.", devDefault: "https://live-qa.ocw.mit.edu/" }), SEARCH_API_URL: envalid.url({ diff --git a/package.json b/package.json index a6c331540..fb97b5a52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ocw-hugo-themes", - "version": "1.91.0", + "version": "1.92.0", "description": "A Hugo theme for building OCW websites", "repository": "mitodl/ocw-hugo-themes", "main": "base-theme/assets/index.js", @@ -97,7 +97,7 @@ "expose-loader": "^4.0.0", "fancy-log": "^1.3.2", "file-loader": "^5.0.2", - "fuse.js": "^6.5.3", + "fuse.js": "^6.6.2", "gulp": "^4.0.2", "history": "^5.3.0", "hugo-bin-extended": "~0.112.7", diff --git a/tests-e2e/ocw-ci-test-course/homepage.spec.ts b/tests-e2e/ocw-ci-test-course/homepage.spec.ts index 0b36c59d7..c33939c14 100644 --- a/tests-e2e/ocw-ci-test-course/homepage.spec.ts +++ b/tests-e2e/ocw-ci-test-course/homepage.spec.ts @@ -62,3 +62,13 @@ test.describe("Course info", () => { }) }) }) + +test("og:image tag has fully-qualified URL", async ({ page }) => { + const course = new CoursePage(page, "course") + await course.goto() + const metaShareImage = page.locator('meta[property="og:image"]') + await expect(metaShareImage).toHaveAttribute( + "content", + "https://live-qa.ocw.mit.edu/courses/123-ocw-ci-test-course-fall-2022/example_jpg.jpg" + ) +}) diff --git a/www-offline/assets/www-offline.tsx b/www-offline/assets/www-offline.tsx index 30f6a0f0b..358a0f4e5 100644 --- a/www-offline/assets/www-offline.tsx +++ b/www-offline/assets/www-offline.tsx @@ -1,13 +1,16 @@ import "./css/www-offline.scss" +import Fuse from "fuse.js" import Popper from "popper.js" export interface OCWWindow extends Window { $: JQueryStatic jQuery: JQueryStatic Popper: typeof Popper + Fuse: typeof Fuse } declare let window: OCWWindow window.jQuery = $ window.$ = $ window.Popper = Popper +window.Fuse = Fuse diff --git a/www-offline/content/search/_index.md b/www-offline/content/search/_index.md new file mode 100644 index 000000000..20966b500 --- /dev/null +++ b/www-offline/content/search/_index.md @@ -0,0 +1,5 @@ +--- +title: Search +type: search +renderSearchIcon: false +--- \ No newline at end of file diff --git a/www-offline/layouts/home.html b/www-offline/layouts/home.html index 32c4955d6..175fa1010 100644 --- a/www-offline/layouts/home.html +++ b/www-offline/layouts/home.html @@ -1,17 +1,16 @@ {{ define "main" }}
{{ block "header" . }} - {{ $renderSearchIcon := false }} - {{ partial "header" . $renderSearchIcon }} + {{ partial "header" . }} {{ end }}
-
+
{{ $websites := where site.Pages ".Params.content_type" "==" "website" }} {{ $sortedWebsites := partial "sort_websites_by_course_number.html" $websites }} {{ $paginator := .Paginate $sortedWebsites }} -
+
{{ range $paginator.Pages }} {{ $pathToRoot := strings.TrimSuffix "/" (partial "path_to_root.html" $paginator.URL) }} {{ $urlPath := strings.TrimPrefix "/" .Params.url_path }} diff --git a/www-offline/layouts/partials/extraheader.html b/www-offline/layouts/partials/extraheader.html index e69de29bb..61bb0a537 100644 --- a/www-offline/layouts/partials/extraheader.html +++ b/www-offline/layouts/partials/extraheader.html @@ -0,0 +1,8 @@ +{{ define "extraheader" }} + {{ $renderSearchIcon := index .Params "renderSearchIcon" | default true}} + {{ if $renderSearchIcon}} + + search + + {{end}} +{{ end }} \ No newline at end of file diff --git a/www-offline/layouts/partials/home_url.html b/www-offline/layouts/partials/home_url.html new file mode 100644 index 000000000..1f3cbd9b5 --- /dev/null +++ b/www-offline/layouts/partials/home_url.html @@ -0,0 +1 @@ +{{ return "/index.html" }} \ No newline at end of file diff --git a/www-offline/layouts/partials/include_css.html b/www-offline/layouts/partials/include_css.html index 768fbaec7..da5430aca 100644 --- a/www-offline/layouts/partials/include_css.html +++ b/www-offline/layouts/partials/include_css.html @@ -2,6 +2,6 @@ {{ $urls := .urls }} {{ range $url := $urls }} {{ with $url }} - + {{ end }} {{ end }} \ No newline at end of file diff --git a/www-offline/layouts/search/section.html b/www-offline/layouts/search/section.html new file mode 100644 index 000000000..11b7ed07f --- /dev/null +++ b/www-offline/layouts/search/section.html @@ -0,0 +1,134 @@ +{{ define "main" }} +{{ $pathToRoot := strings.TrimSuffix "/" (partial "path_to_root.html" .Permalink) }} +{{ $websites := where site.Pages ".Params.content_type" "==" "website" }} +{{ block "header" . }} +{{ partial "header" . }} +{{ end }} +
+
+
+
+
+
+
+
+
+ +
+
+

Start typing to search

+
+
+
+
+
+
+
+
+
+ +{{ end }} diff --git a/yarn.lock b/yarn.lock index 54235ad68..1ccf2ab53 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8230,10 +8230,10 @@ __metadata: languageName: node linkType: hard -"fuse.js@npm:^6.5.3": - version: 6.5.3 - resolution: "fuse.js@npm:6.5.3" - checksum: f7c14f4422000e7f7e3515c66f7cefdfc38adec4cf380097f4146a201ea438af60b67dc5849b3c0de0115ce3f9bc5afad6fc6570c08dcfcef5bf6e95eb8e6d6f +"fuse.js@npm:^6.6.2": + version: 6.6.2 + resolution: "fuse.js@npm:6.6.2" + checksum: 17ae758ce205276ebd88bd9c9f088a100be0b4896abac9f6b09847151269d1690f41d7f98ff5813d4a58973162dbd99d0072ce807020fee6f9de60170f6b08eb languageName: node linkType: hard @@ -12910,7 +12910,7 @@ __metadata: expose-loader: ^4.0.0 fancy-log: ^1.3.2 file-loader: ^5.0.2 - fuse.js: ^6.5.3 + fuse.js: ^6.6.2 gulp: ^4.0.2 history: ^5.3.0 hugo-bin-extended: ~0.112.7