From 74aa6ddf9f2bf1e659c7d1369da28c1df25771a5 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 09:13:47 +0300 Subject: [PATCH 01/18] fix result links --- src/components/SiteSearch.jsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 00e9fe74473f..3aa05974e993 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -8,6 +8,8 @@ import { import { Breadcrumbs } from './Breadcrumbs'; +import { prependBaseURL } from '../utils/url'; + const style = { "--_c-button-font-size": 14, "--_c-button-min-width": 0, @@ -64,7 +66,7 @@ function searchContent(query, store) { for (const key of ['blogs', 'events', 'pages']) { for (const item of store[key]) { if (item.title.toLowerCase().includes(query.toLowerCase())) { - categorizedResults.general.push({ + const resultItem = { title: item.title, url: item.url, excerpt: item.content.substring(0, 200) + '...', @@ -72,7 +74,15 @@ function searchContent(query, store) { tags: item.tags, date: item.date, link: item?.link - }); + }; + + if (item.type === "page") { + categorizedResults.general.push(resultItem); + } else if (item.type === "post") { + categorizedResults.blogs.push(resultItem); + } else if (item.type === "Event") { + categorizedResults.events.push(resultItem); + } } } } @@ -175,7 +185,7 @@ const ResultArea = ({ paginationOptions, setOptions, results, type, href }) => { paginationOptions.itemsPerPage, (paginationOptions.currentPage - 1) * paginationOptions.itemsPerPage + paginationOptions.itemsPerPage).map((item, index) => (
  • - {item.title}
    + {item.title}

    {capitalizeFirstLetter(item.type)}

    {type !== "general" && @@ -224,7 +234,7 @@ const FilterModal = ({ isModalOpen, setIsModalOpen, filters, handleCheckboxChang return ( setIsModalOpen(event.detail)} From ddc64009a9a16bfcd9e2fbabd801c8d26e4864a8 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 09:42:09 +0300 Subject: [PATCH 02/18] small refactor --- src/components/SiteSearch.jsx | 85 +++++++++++------------------------ 1 file changed, 27 insertions(+), 58 deletions(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 3aa05974e993..07876f79456a 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -47,72 +47,40 @@ function searchContent(query, store) { this.field('date'); this.field('link'); - ['blogs', 'events', 'pages'].forEach(key => { - store[key].forEach(doc => { - this.add(doc); - }); - }); + Object.values(store).flat().forEach(doc => this.add(doc)); }); const results = idx.search(queryStr); - const categorizedResults = { - general: [], - blogs: [], - events: [] + const categorizedResults = { general: [], blogs: [], events: [] }; + + const addResult = (item) => { + const resultItem = { + title: item.title, + url: item.url, + excerpt: item.content.substring(0, 200) + '...', + type: item.type, + tags: item.tags, + date: item.date, + link: item?.link + }; + + if (item.type === "page") categorizedResults.general.push(resultItem); + else if (item.type === "post") categorizedResults.blogs.push(resultItem); + else if (item.type === "Event") categorizedResults.events.push(resultItem); }; if (results.length === 0) { - for (const key of ['blogs', 'events', 'pages']) { - for (const item of store[key]) { - if (item.title.toLowerCase().includes(query.toLowerCase())) { - const resultItem = { - title: item.title, - url: item.url, - excerpt: item.content.substring(0, 200) + '...', - type: item.type, - tags: item.tags, - date: item.date, - link: item?.link - }; - - if (item.type === "page") { - categorizedResults.general.push(resultItem); - } else if (item.type === "post") { - categorizedResults.blogs.push(resultItem); - } else if (item.type === "Event") { - categorizedResults.events.push(resultItem); - } - } - } - } + Object.values(store).flat().forEach(item => { + if (item.title.toLowerCase().includes(query.toLowerCase())) addResult(item); + }); + } else { + results.forEach(result => { + const item = findItemByRef(result.ref, store); + if (item) addResult(item); + }); } - - results.forEach(result => { - const item = findItemByRef(result.ref, store); - if (item) { - const resultItem = { - title: item.title, - url: item.url, - excerpt: item.content.substring(0, 200) + '...', - type: item.type, - tags: item.tags, - date: item.date, - link: item?.link - }; - - if (item.type === "page") { - categorizedResults.general.push(resultItem); - } else if (item.type === "post") { - categorizedResults.blogs.push(resultItem); - } else if (item.type === "Event") { - categorizedResults.events.push(resultItem); - } - } - }); - - return categorizedResults; } @@ -166,7 +134,7 @@ const SearchBar = ({ setResults }) => { const ResultArea = ({ paginationOptions, setOptions, results, type, href }) => { const handlePageChange = (setOptions) => (event) => { - // event.detail should be the new page number. + // event.detail.currentPage should be the new page number. setOptions(prev => ({ ...prev, currentPage: event.detail.currentPage })); }; @@ -390,6 +358,7 @@ export const SiteSearch = () => { (Object.keys(filteredResults).every(key => filteredResults[key].length === 0) && searchCount > 0) &&

    No results found

    } + From 533b50bf7a8e62b89eb41c003c1863728137881e Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 15:51:32 +0300 Subject: [PATCH 03/18] tweak search --- src/components/SiteSearch.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 07876f79456a..4e11a13af988 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -30,9 +30,12 @@ function normalizeQuery(query) { if (query.endsWith('*')) return query; // Optionally boost exact matches + const exactLongMatch = `${'" ' + query + ' "'}^15` + const exactLongMatchW = `${'" ' + query + ' "'}*^15` const exactMatch = `${query}^10`; // high boost for exact match const wildcardMatch = `${query}*`; // normal wildcard match - return `${exactMatch} ${wildcardMatch}`; + //console.log(`${exactMatch} ${wildcardMatch} ${exactLongMatch} ${exactLongMatchW}`) + return `${exactLongMatch} ${exactLongMatchW}`; } function searchContent(query, store) { From d3bab60ea6699e7ef64d1b763af42a9d80eb8697 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 12 May 2025 15:51:47 +0300 Subject: [PATCH 04/18] search hero constants for home --- content/store.js.liquid | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/content/store.js.liquid b/content/store.js.liquid index 41826370d212..cd08990dfe88 100644 --- a/content/store.js.liquid +++ b/content/store.js.liquid @@ -42,10 +42,16 @@ permalink: store.js {%- assign filtered_pages = filtered_pages | reject: "url", "/api/" -%} {%- for page in filtered_pages -%} {%- unless page.url contains '.json' or page.url contains '.css' or page.url contains '.js' or page.path contains '/api/' -%} + {%- assign base_content = page.content | default: "" -%} + {%- if page.url == "/" -%} + {%- assign full_content = base_content | append: site.data.constants.hero | append: site.data.contants.access_cards -%} + {%- else -%} + {%- assign full_content = base_content -%} + {%- endif -%} { "key": "{{ page.url | slugify }}", "title": {{ page.title | default: "" | jsonify }}, - "content": {{ page.content | default: "" | strip_html | strip_newlines | jsonify }}, + "content": {{ full_content | strip_html | strip_newlines | jsonify }}, "url": {{ page.url | jsonify }}, "tags": [], "type": "page" @@ -56,6 +62,7 @@ permalink: store.js {%- endcapture -%} + const STORE = { blogs: {{blogs}}, events: {{events}}, From e4af8cb3f453669f8705f84c58c9211442261f0c Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Thu, 5 Jun 2025 15:34:16 +0300 Subject: [PATCH 05/18] refactor for separate pages --- content/_data/constants.yml | 234 ++++++++++++++++++------------------ 1 file changed, 118 insertions(+), 116 deletions(-) diff --git a/content/_data/constants.yml b/content/_data/constants.yml index 61842a6233c6..af960d6f499b 100644 --- a/content/_data/constants.yml +++ b/content/_data/constants.yml @@ -2,6 +2,15 @@ title: FiQCI author: The FiQCI Consortium copyright: © 2024 The FiQCI Consortium feedback_email: fiqci-feedback@postit.csc.fi +logo: assets/images/FiQCI-logo.png +favicon: assets/images/favicon.png +footer_icons: assets/footer-icons +funder_logos: assets/images/funders +description: >- + Web presence of the Finnish Quantum-Computing Infrastructure. We provide state-of-the-art quantum-computing + services to Finnish RDI communities. +excerpt_max_length: 250 +title_separator: " – " header_nav: - title: Home @@ -19,115 +28,118 @@ header_nav: - title: Search page: pages/search.md -hero: - tagline: Making the power of quantum computing accessible - subtitle: FiQCI – Finnish quantum-computing infrastructure - announcement: - text: Open call for pilot access to Helmi quantum computer now open! - link: - title: How to access Helmi, instructions - href: FIXME - buttons: - - title: How to get access - href: "#get-access" - - title: Blogs and instructions - href: /publications - - title: About FiQCI - href: "#about-fiqci" - -access_cards: - - title: LUMI - href: FIXME - teaser: /assets/images/FiQCI-banner.jpg - description: |- - The backbone of the classical HPC resources in FiQCI, and the portal for quantum computing resources, - is the pan-European EuroHPC LUMI supercomputer. LUMI is the fastest and greenest supercomputer in Europe, - hosted by CSC in Kajaani, Finland. - links: - - title: Getting started with Lumi - href: https://www.lumi-supercomputer.eu/get-started/ - - title: Helmi - VTT Q5 - href: FIXME - teaser: /assets/images/vtt-images/VTT_lab-2.jpg - description: |- - Helmi, the first Finnish quantum computer, co-developed by VTT and IQM Quantum Computers, - is operated by VTT in Espoo, Finland. Helmi is based on superconducting technology, - and presently provides five qubits. Upgrades to 20, then 50 qubits is planned for the near future. - links: - - title: How to access Helmi, instructions - href: FIXME - - title: Read more about Helmi +#Following are constanst per page. Can be accessed with page.url +"/": + hero: + tagline: Making the power of quantum computing accessible + subtitle: FiQCI – Finnish quantum-computing infrastructure + announcement: + text: Open call for pilot access to Helmi quantum computer now open! + link: + title: How to access Helmi, instructions + href: FIXME + buttons: + - title: How to get access + href: "#get-access" + - title: Blogs and instructions + href: /publications + - title: About FiQCI + href: "#about-fiqci" + + access_cards: + - title: LUMI href: FIXME - - title: Kvasi - href: FIXME - teaser: /assets/images/FiQCI-banner.jpg - description: |- - Kvasi, the Atos Quantum Learning Machine or Qaptiva is a quantum computing simulator with which you can learn - to use and develop new quantum algorithms. Kvasi provides a platform for developing and simulating quantum - algorithms in both ideal and realistic, noisy conditions. Kvasi is capable of simulating algorithms for - quantum computers of 30+ qubits. - links: - - title: How to access Kvasi, instructions + teaser: /assets/images/FiQCI-banner.jpg + description: |- + The backbone of the classical HPC resources in FiQCI, and the portal for quantum computing resources, + is the pan-European EuroHPC LUMI supercomputer. LUMI is the fastest and greenest supercomputer in Europe, + hosted by CSC in Kajaani, Finland. + links: + - title: Getting started with Lumi + href: https://www.lumi-supercomputer.eu/get-started/ + - title: Helmi - VTT Q5 href: FIXME - - title: Read more about Kvasi + teaser: /assets/images/vtt-images/VTT_lab-2.jpg + description: |- + Helmi, the first Finnish quantum computer, co-developed by VTT and IQM Quantum Computers, + is operated by VTT in Espoo, Finland. Helmi is based on superconducting technology, + and presently provides five qubits. Upgrades to 20, then 50 qubits is planned for the near future. + links: + - title: How to access Helmi, instructions + href: FIXME + - title: Read more about Helmi + href: FIXME + - title: Kvasi href: FIXME - -quantum_resources: - - name: Helmi - desc: |- - Helmi (VTT Q5), the Finnish quantum computer operated by VTT, co-developed with IQM. - Helmi is based on superconducting technology, and presently provides five qubits. - Upgrades to 20, then 50 qubits is planned for the near future. Helmi is accessible - through the LUMI supercomputer environment. The pilot phase for Helmi access is now running! - image: "/assets/images/vtt-images/VTT_lab-2.jpg" - links: - - link: "" - teaser: "How to access Helmi, instructions" - icon: mdiArrowRight - - link: "" - teaser: "Read more about Helmi (VTT website)" - icon: mdiOpenInNew - - - name: VTT Q50 - desc: |- - Lorem ipsum the Finnish quantum computer operated by VTT, co-developed with IQM. - Lorem ipsum is accessible through the LUMI supercomputer environment. The pilot phase - for VTT Q50 access is now running! - image: "/assets/images/vtt-images/VTT_lab-2.jpg" - links: - - link: "" - teaser: "How to access VTT Q50, instructions" - icon: mdiArrowRight - - link: "" - teaser: "Read more about VTT Q50 (VTT website)" - icon: mdiOpenInNew - -supercomputer_resources: - - name: LUMI - desc: |- - The backbone of the classical HPC resources in FiQCI, and the portal for quantum computing resources, - is the pan-European EuroHPC LUMI supercomputer. LUMI is the fastest and greenest supercomputer in Europe, - hosted by CSC in Kajaani, Finland. - image: "/assets/images/FiQCI-banner.jpg" - links: - - link: "" - teaser: "How to access Lumi" - icon: mdiArrowRight - - link: "" - teaser: "Read more about LUMI (LUMI website)" - icon: mdiOpenInNew - -emulation_resources: - - name: Quantum emuation with LUMI - desc: |- - With the LUMI supercomputer it is possible to emulate quantum computer with upto 40+ qubits. - image: "/assets/images/FiQCI-banner.jpg" - links: - - link: "" - teaser: "Quantum emulation dosumentation" - icon: mdiArrowRight - -about: + teaser: /assets/images/FiQCI-banner.jpg + description: |- + Kvasi, the Atos Quantum Learning Machine or Qaptiva is a quantum computing simulator with which you can learn + to use and develop new quantum algorithms. Kvasi provides a platform for developing and simulating quantum + algorithms in both ideal and realistic, noisy conditions. Kvasi is capable of simulating algorithms for + quantum computers of 30+ qubits. + links: + - title: How to access Kvasi, instructions + href: FIXME + - title: Read more about Kvasi + href: FIXME + +"/access/": + quantum_resources: + - name: Helmi + desc: |- + Helmi (VTT Q5), the Finnish quantum computer operated by VTT, co-developed with IQM. + Helmi is based on superconducting technology, and presently provides five qubits. + Upgrades to 20, then 50 qubits is planned for the near future. Helmi is accessible + through the LUMI supercomputer environment. The pilot phase for Helmi access is now running! + image: "/assets/images/vtt-images/VTT_lab-2.jpg" + links: + - link: FIXME + teaser: "How to access Helmi, instructions" + icon: mdiArrowRight + - link: FIXME + teaser: "Read more about Helmi (VTT website)" + icon: mdiOpenInNew + + - name: VTT Q50 + desc: |- + Lorem ipsum the Finnish quantum computer operated by VTT, co-developed with IQM. + Lorem ipsum is accessible through the LUMI supercomputer environment. The pilot phase + for VTT Q50 access is now running! + image: "/assets/images/vtt-images/VTT_lab-2.jpg" + links: + - link: FIXME + teaser: "How to access VTT Q50, instructions" + icon: mdiArrowRight + - link: FIXME + teaser: "Read more about VTT Q50 (VTT website)" + icon: mdiOpenInNew + + supercomputer_resources: + - name: LUMI + desc: |- + The backbone of the classical HPC resources in FiQCI, and the portal for quantum computing resources, + is the pan-European EuroHPC LUMI supercomputer. LUMI is the fastest and greenest supercomputer in Europe, + hosted by CSC in Kajaani, Finland. + image: "/assets/images/FiQCI-banner.jpg" + links: + - link: FIXME + teaser: "How to access Lumi" + icon: mdiArrowRight + - link: FIXME + teaser: "Read more about LUMI (LUMI website)" + icon: mdiOpenInNew + + emulation_resources: + - name: Quantum emuation with LUMI + desc: |- + With the LUMI supercomputer it is possible to emulate quantum computer with upto 40+ qubits. + image: "/assets/images/FiQCI-banner.jpg" + links: + - link: FIXME + teaser: "Quantum emulation dosumentation" + icon: mdiArrowRight + +"/about/": desc: |- The Finnish Quantum-Computing Infrastructure (FiQCI) was established in 2020, when it became part of the Finnish Research Infrastructure (FIRI) roadmap of significant national research @@ -194,13 +206,3 @@ about: helmi-link-url: /publications/2022-11-01-Helmi_pilot helmi-link-text: Additionally, users should also acknowledge using Helmi if applicable - -logo: assets/images/FiQCI-logo.png -favicon: assets/images/favicon.png -footer_icons: assets/footer-icons -funder_logos: assets/images/funders -description: >- - Web presence of the Finnish Quantum-Computing Infrastructure. We provide state-of-the-art quantum-computing - services to Finnish RDI communities. -excerpt_max_length: 250 -title_separator: " – " From 0dfda65a0b8c63f1d1f06b5d378973ef97648c92 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Thu, 5 Jun 2025 15:34:55 +0300 Subject: [PATCH 06/18] refactor to use new site constants --- content/_layouts/home.html | 2 +- src/layouts/home.html.jsx | 5 ++--- src/pages/access.md.jsx | 5 +++-- src/pages/home.md.jsx | 3 +-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/content/_layouts/home.html b/content/_layouts/home.html index 32e0efdbd57c..39949cce5a00 100644 --- a/content/_layouts/home.html +++ b/content/_layouts/home.html @@ -2,7 +2,7 @@ layout: base --- -{% assign about_data = site.data.constants.about %} +{% assign about_data = site.data.constants["/about/"] %} {%- include react/root.html id='hero' -%} diff --git a/src/layouts/home.html.jsx b/src/layouts/home.html.jsx index ab509254459b..679d7b0538df 100644 --- a/src/layouts/home.html.jsx +++ b/src/layouts/home.html.jsx @@ -7,12 +7,11 @@ import { BaseLayout } from './base.html' export const HomeLayout = props => { - const heroConstants = props.hero - + const heroProps = props["/"]?.hero return <> {createPortal( - , + , document.getElementById('hero') )} diff --git a/src/pages/access.md.jsx b/src/pages/access.md.jsx index 2570af21aded..4c19570e649a 100644 --- a/src/pages/access.md.jsx +++ b/src/pages/access.md.jsx @@ -11,11 +11,12 @@ import { useJsonApi } from '../hooks/useJsonApi' const AccessPage = () => { const themeConstants = useJsonApi('api/theme/constants.json') - + console.log(themeConstants) + const accessProps = themeConstants["/access/"] return <> {createPortal( - , + , document.getElementById('access') )} diff --git a/src/pages/home.md.jsx b/src/pages/home.md.jsx index 7b3c1db46880..48cda9b116d0 100644 --- a/src/pages/home.md.jsx +++ b/src/pages/home.md.jsx @@ -13,8 +13,7 @@ import { useJsonApi } from '../hooks/useJsonApi' const HomePage = () => { const themeConstants = useJsonApi('api/theme/constants.json') - const accessCards = themeConstants.access_cards || [] - + const accessCards = themeConstants["/"]?.access_cards || [] return <> {createPortal( From 46b76c6fae55539ab3bb2d9a15e01f7993a08279 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Thu, 5 Jun 2025 15:35:09 +0300 Subject: [PATCH 07/18] include site constants in store for respective pages --- content/store.js.liquid | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/content/store.js.liquid b/content/store.js.liquid index cd08990dfe88..2c465d0b1fcc 100644 --- a/content/store.js.liquid +++ b/content/store.js.liquid @@ -43,11 +43,7 @@ permalink: store.js {%- for page in filtered_pages -%} {%- unless page.url contains '.json' or page.url contains '.css' or page.url contains '.js' or page.path contains '/api/' -%} {%- assign base_content = page.content | default: "" -%} - {%- if page.url == "/" -%} - {%- assign full_content = base_content | append: site.data.constants.hero | append: site.data.contants.access_cards -%} - {%- else -%} - {%- assign full_content = base_content -%} - {%- endif -%} + {%- assign full_content = base_content | append: site.data.constants[page.url] -%} { "key": "{{ page.url | slugify }}", "title": {{ page.title | default: "" | jsonify }}, From 6a0bfd555eb34e59dea4d2f0996442eb410bb69d Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Thu, 5 Jun 2025 15:36:20 +0300 Subject: [PATCH 08/18] remove unsused stuff in normalizeQuery --- src/components/SiteSearch.jsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 120fcf94d451..115f24acc8ee 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -28,13 +28,12 @@ function normalizeQuery(query) { if (!query.trim()) return ''; // empty or whitespace-only if (query.endsWith('*')) return query; - // Optionally boost exact matches - const exactLongMatch = `${'" ' + query + ' "'}^15` - const exactLongMatchW = `${'" ' + query + ' "'}*^15` + // Boost exact matches + //const exactLongMatch = `${'" ' + query + ' "'}^15` + //const exactLongMatchW = `${'" ' + query + ' "'}*^15` const exactMatch = `${query}^10`; // high boost for exact match const wildcardMatch = `${query}*`; // normal wildcard match - //console.log(`${exactMatch} ${wildcardMatch} ${exactLongMatch} ${exactLongMatchW}`) - return `${exactLongMatch} ${exactLongMatchW}`; + return `${exactMatch} ${wildcardMatch}`; } function searchContent(query, store) { @@ -162,7 +161,9 @@ const ResultArea = ({ paginationOptions, setOptions, results, type, href }) => {

       |   {item?.date}

    }
    - {item.excerpt} + {type !== "general" && + {item.excerpt} + }
  • ))} From a06813b6261e8958c49fbc4c1b543041af9c9c68 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Thu, 5 Jun 2025 15:41:12 +0300 Subject: [PATCH 09/18] use refsctored constants --- content/pages/about.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/pages/about.md b/content/pages/about.md index 4865a5eb8d81..6517d8f03dfb 100644 --- a/content/pages/about.md +++ b/content/pages/about.md @@ -5,7 +5,7 @@ subtitle: The FiQCI consortium maintains, operates, and develops the infrastruct react: true --- -{% assign about_data = site.data.constants.about %} +{% assign about_data = site.data.constants.["/about/"] %}

    About FiQCI

    From 91d12ae22f91944a5647f8617a559437165ff8f0 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 16:50:30 +0300 Subject: [PATCH 10/18] typo --- content/_data/constants.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/_data/constants.yml b/content/_data/constants.yml index af960d6f499b..cf22702cf293 100644 --- a/content/_data/constants.yml +++ b/content/_data/constants.yml @@ -28,7 +28,7 @@ header_nav: - title: Search page: pages/search.md -#Following are constanst per page. Can be accessed with page.url +#Following are constants per page. Can be accessed with page.url "/": hero: tagline: Making the power of quantum computing accessible From 8f59601bf7a8127c9dfa69d682d67f0fe0716458 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 16:52:06 +0300 Subject: [PATCH 11/18] remove uncecessary assign --- content/store.js.liquid | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/store.js.liquid b/content/store.js.liquid index 2c465d0b1fcc..a47ec4ce89da 100644 --- a/content/store.js.liquid +++ b/content/store.js.liquid @@ -42,8 +42,7 @@ permalink: store.js {%- assign filtered_pages = filtered_pages | reject: "url", "/api/" -%} {%- for page in filtered_pages -%} {%- unless page.url contains '.json' or page.url contains '.css' or page.url contains '.js' or page.path contains '/api/' -%} - {%- assign base_content = page.content | default: "" -%} - {%- assign full_content = base_content | append: site.data.constants[page.url] -%} + {%- assign full_content = page.content | default: "" | append: site.data.constants[page.url] -%} { "key": "{{ page.url | slugify }}", "title": {{ page.title | default: "" | jsonify }}, From 3983fa53731e32cd319ed6bfe956335cbe806ba8 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 16:52:38 +0300 Subject: [PATCH 12/18] remove unecessary optional chain --- src/components/SiteSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 115f24acc8ee..68f12bea3390 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -63,7 +63,7 @@ function searchContent(query, store) { type: item.type, tags: item.tags, date: item.date, - link: item?.link + link: item.link }; if (item.type === "page") categorizedResults.general.push(resultItem); From 16f87ea440a0d82ce939c655a56533e8f6c71528 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 16:56:50 +0300 Subject: [PATCH 13/18] check for item.content, trim, default to empty --- src/components/SiteSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 68f12bea3390..d85945eeb7ed 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -59,7 +59,7 @@ function searchContent(query, store) { const resultItem = { title: item.title, url: item.url, - excerpt: item.content.substring(0, 200) + '...', + excerpt: item.content ? item.content.substring(0, 200).trim() + '...' : '', type: item.type, tags: item.tags, date: item.date, From 9be7dc77458c634fd01435b4bdd93f2d95415bf8 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 16:57:22 +0300 Subject: [PATCH 14/18] add toLowerCase() --- src/components/SiteSearch.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index d85945eeb7ed..ae01eeae726b 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -66,9 +66,9 @@ function searchContent(query, store) { link: item.link }; - if (item.type === "page") categorizedResults.general.push(resultItem); - else if (item.type === "post") categorizedResults.blogs.push(resultItem); - else if (item.type === "Event") categorizedResults.events.push(resultItem); + if (item.type.toLowerCase() === "page") categorizedResults.general.push(resultItem); + else if (item.type.toLowerCase() === "post") categorizedResults.blogs.push(resultItem); + else if (item.type.toLowerCase() === "event") categorizedResults.events.push(resultItem); }; if (results.length === 0) { From e27b670b9848d3b90781c0cf0b2fe0ddfb8d678b Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 16:58:29 +0300 Subject: [PATCH 15/18] defualt to general if unknown type --- src/components/SiteSearch.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index ae01eeae726b..719d1a49f68c 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -69,6 +69,7 @@ function searchContent(query, store) { if (item.type.toLowerCase() === "page") categorizedResults.general.push(resultItem); else if (item.type.toLowerCase() === "post") categorizedResults.blogs.push(resultItem); else if (item.type.toLowerCase() === "event") categorizedResults.events.push(resultItem); + else categorizedResults.general.push(resultItem); // default to general }; if (results.length === 0) { From c238107eb6ff09da1d18869ae0eea611f0f7f7c1 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 17:00:48 +0300 Subject: [PATCH 16/18] cleaner category assignment --- src/components/SiteSearch.jsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 719d1a49f68c..58b9a3738fa8 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -66,10 +66,19 @@ function searchContent(query, store) { link: item.link }; - if (item.type.toLowerCase() === "page") categorizedResults.general.push(resultItem); - else if (item.type.toLowerCase() === "post") categorizedResults.blogs.push(resultItem); - else if (item.type.toLowerCase() === "event") categorizedResults.events.push(resultItem); - else categorizedResults.general.push(resultItem); // default to general + const typeMap = { + page: 'general', + post: 'blogs', + Event: 'events' + }; + + const category = typeMap[item.type]; + if (category) { + categorizedResults[category].push(resultItem); + } + else { + categorizedResults['general'].push(resultItem) + } }; if (results.length === 0) { @@ -162,7 +171,7 @@ const ResultArea = ({ paginationOptions, setOptions, results, type, href }) => {

       |   {item?.date}

    }
    - {type !== "general" && + {type !== "general" && {item.excerpt} } From 774c769e05ffd04293ca90e1e23c9867c102ac44 Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 17:07:26 +0300 Subject: [PATCH 17/18] convert type to lowercase when adding to results -> no need to do it in multiple places --- src/components/SiteSearch.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index 58b9a3738fa8..f4a3132964e5 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -60,7 +60,7 @@ function searchContent(query, store) { title: item.title, url: item.url, excerpt: item.content ? item.content.substring(0, 200).trim() + '...' : '', - type: item.type, + type: item.type.toLowerCase(), tags: item.tags, date: item.date, link: item.link @@ -69,10 +69,10 @@ function searchContent(query, store) { const typeMap = { page: 'general', post: 'blogs', - Event: 'events' + event: 'events' }; - const category = typeMap[item.type]; + const category = typeMap[resultItem.type]; if (category) { categorizedResults[category].push(resultItem); } @@ -321,9 +321,9 @@ export const SiteSearch = () => { return activeFilters.some(filter => { const filterLower = filter.toLowerCase(); - if (filterLower === "blog" && item.type.toLowerCase() === "post") return true; - if (filterLower === "event" && item.type.toLowerCase() === "event") return true; - if (filterLower === "general information" && item.type.toLowerCase() === "page") return true; + if (filterLower === "blog" && item.type === "post") return true; + if (filterLower === "event" && item.type === "event") return true; + if (filterLower === "general information" && item.type === "page") return true; return false; }); From 0267c47333c44c84b4f3c0abf5ca045e837bed9f Mon Sep 17 00:00:00 2001 From: Joonas Nivala Date: Mon, 9 Jun 2025 17:27:40 +0300 Subject: [PATCH 18/18] TODO --- src/components/SiteSearch.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/SiteSearch.jsx b/src/components/SiteSearch.jsx index f4a3132964e5..eec63e8d8795 100644 --- a/src/components/SiteSearch.jsx +++ b/src/components/SiteSearch.jsx @@ -324,6 +324,7 @@ export const SiteSearch = () => { if (filterLower === "blog" && item.type === "post") return true; if (filterLower === "event" && item.type === "event") return true; if (filterLower === "general information" && item.type === "page") return true; + //TODO add filter toggles for instructions and news once this is merged with pr 18 and 19 return false; });