This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 1b728598b1 Fix blogpost search (#960)
1b728598b1 is described below

commit 1b728598b119faf4ffb164a069e0d36ff3cca702
Author: Aritra Basu <24430013+aritr...@users.noreply.github.com>
AuthorDate: Sun Feb 18 12:31:16 2024 +0530

    Fix blogpost search (#960)
    
    Blogpost search failed because certain articles didn't have tags
    which are assumed to exist leading to npe. Also the hyperlink
    setting query selector had a type.
---
 landing-pages/src/js/searchBlogPosts.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/landing-pages/src/js/searchBlogPosts.js 
b/landing-pages/src/js/searchBlogPosts.js
index c63f1c7c4f..c78b63dfaa 100644
--- a/landing-pages/src/js/searchBlogPosts.js
+++ b/landing-pages/src/js/searchBlogPosts.js
@@ -79,8 +79,8 @@ if (window.location.pathname.startsWith("/blog") && 
searchString) {
         $newResultItem.querySelector(".box-event__blogpost--author").innerText 
= result.post.author;
         
$newResultItem.querySelector(".box-event__blogpost--description").innerText = 
result.post.description;
         $newResultItem.querySelector(".box-event__blogpost--date").innerText = 
formatDate(result.post.date);
-        setTags($newResultItem.querySelector(".box-event__blogpost--metadata > 
.tags-container"), result.post.tags);
-        $newResultItem.querySelector(".box-event__blogpost > a").href = 
`/blog/${result.post.url}/`;
+        setTags($newResultItem.querySelector(".box-event__blogpost--metadata > 
.tags-container"), Object.hasOwn(result.post, "tag") ? result.post.tag : []);
+        $newResultItem.querySelectorAll(".box-event__blogpost a").forEach((e) 
=> e.href = `/blog/${result.post.url}/`);
         $target.append($newResultItem);
       });
     } else {

Reply via email to