Skip to content

Commit

Permalink
Add search term to URL bar
Browse files Browse the repository at this point in the history
xref #4586
  • Loading branch information
hexylena committed Dec 14, 2023
1 parent 9db8751 commit abc927a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions _layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
{% assign og_title = page.title %}
{% endif %}
{% assign og_desc = page.description | default:topic.summary | default: "Collection of tutorials developed and maintained by the worldwide Galaxy community" %}
<meta name="description" content="{{ og_desc | strip_html | truncate: 120}}">
<meta name="description" content="{{ og_desc | strip_html}}">
<meta property="og:site_name" content="Galaxy Training Network">
<meta property="og:title" content="Galaxy Training{% if og_title %}: {{ og_title | truncate: 60}}{% endif %}">
<meta property="og:description" content="{{ og_desc | strip_html | truncate: 120}}">
<meta property="og:description" content="{{ og_desc | strip_html}}">

{%- if page.cover %}{% assign coverimage = page.cover %}
{%- elsif page.tags contains "cofest" %}{% assign coverimage = "/assets/images/cofest.png" %}
Expand Down
3 changes: 2 additions & 1 deletion search-tools.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: page
title: Pan Galactic Tool Search
title: GTN Pan-Galactic Tool Search
---


Expand Down Expand Up @@ -78,6 +78,7 @@
return
}

document.getElementsByTagName("title")[0].innerText = `${textQuery} | GTN Pan-Galactic Tool Search`
console.log(`Searching! ${textQuery}`)

// Which should be hidden
Expand Down
5 changes: 4 additions & 1 deletion search.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: page
title: Search Tutorials
title: GTN Tutorial Search
---

<script src="https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.9/lunr.min.js" integrity="sha512-4xUl/d6D6THrAnXAwGajXkoWaeMNwEKK4iNfq5DotEbLPAfk6FSxSP3ydNxqDgCw1c/0Z1Jg6L8h2j+++9BZmg==" crossorigin="anonymous"></script>
Expand Down Expand Up @@ -29,6 +29,9 @@ function search(idx, q, includeFaqs, includeTutorials){
results_exact = idx.search(`${q}`),
results_fuzzy = idx.search(`${q}~3`);

// Include search term in page title
document.getElementsByTagName("title")[0].innerText = `${q} | GTN Tutorial Search`

thereMap = Object.assign({}, ...results_partial.map((x) => ({[x.ref]: x.score})));

results_exact.forEach(x => {
Expand Down
4 changes: 3 additions & 1 deletion search2.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: page
title: Search GTN Materials
title: GTN Materials Search
---

<p>
Expand Down Expand Up @@ -120,6 +120,8 @@
return
}

// Include search term in page title
document.getElementsByTagName("title")[0].innerText = `${textQuery} | GTN Materials Search`
console.log(`Searching! ${textQuery} ${typeFilter} ${levelFilter}`)

// Which should be hidden
Expand Down
4 changes: 3 additions & 1 deletion workflows/list.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: page
title: Cross UseGalaxy.* Workflow Search
title: GTN Pan-Galactic Workflow Search
---

<p>
Expand Down Expand Up @@ -101,6 +101,8 @@
return
}

// Include search term in page title
document.getElementsByTagName("title")[0].innerText = `${textQuery} | GTN Pan-Galactic Workflow Search`
console.log(`Searching! ${textQuery}`)

// Which should be hidden
Expand Down

0 comments on commit abc927a

Please sign in to comment.