1
0
mirror of https://github.com/bitwarden/help synced 2025-12-06 00:03:30 +00:00
Files
help/search/index.html
David Choi 80a0b17ac6 Staging (#294)
* jekyll redirect from

* Organizations rev (#262)

* Organizations revisions initial commit.

* API doc updates

* Fix absolute link causing build failure.

* Add import to org article, and downstream order changes.

* Bitwarden 101 videos: 1st steps toward proliferating these throughout /help.

* Added 'Create Your Account' article, which references B101 Videos.

* About SSO redirect & promote importing for orgs up the list

* Create Org FAQs & trim Feature FAQs accordingly.

* Image for Org FAQs

* Move 'About the Business Portal' to Orgs category, and re-order accordingly.

* Final edits.

* Dchoi/bootstrap upgrade (#264)

* bootstrap 4 upgrade and cleanup update gulp tasks

* bootstrap package updates

* renaming file convention

* general outline of help outline

* bitwarden help cleanup

* article cleanup

* article general styling complete

* bootstrap help page upgrades

* sidebar updates

* Dchoi/bootstrap upgrade (#267)

* bootstrap 4 upgrade and cleanup update gulp tasks

* bootstrap package updates

* renaming file convention

* general outline of help outline

* bitwarden help cleanup

* article cleanup

* article general styling complete

* bootstrap help page upgrades

* sidebar updates

* toc dynamic and more updates

* fix callout conditions

* sidebar collapse functionality added

* sidebar header toggle functionality

* sidebar article fixes

* Update sidebar.html

Fix sidebar Release Notes link.

* Update releasenotes.md

Remove unnecessary category tag.

* Delete release-notes.md

Remove unnecessary category.

* Update why-choose-bitwarden-for-your-team.md

Test table image differentiation

* Update why-choose-bitwarden-for-your-team.md

Second image differentiation test

* removed links from category breadcrumb and replaced with badges

Co-authored-by: fred_the_tech_writer <69817454+fschillingeriv@users.noreply.github.com>
2020-11-13 14:23:00 -08:00

98 lines
3.3 KiB
HTML

---
layout: default
title: Search Results
---
<div class="search-results">
<h1 class="article-header">
<i class="fa fa-search"></i>
{{page.title}}
<small class="text-muted">"<span id="search-term"></span>"</small>
</h1>
<div class="articles search-results">
<ol id="search-results"></ol>
</div>
</div>
<script src="../lib/lunr/lunr.js"></script>
<script>
window.store = {
{% for article in site.articles %}
{% if article.hidden != true %}
"{{article.url | slugify}}": {
"title": "{{article.title | xml_escape}}",
"tags": "{{article.tags | join: ', ' | xml_escape}}",
"content": {{article.content | strip_html | strip_newlines | jsonify}},
"url": "{{site.baseurl}}{{article.url | xml_escape}}"
}
{% unless forloop.last %},{% endunless %}
{% endif %}
{% endfor %}
};
(function() {
function displaySearchResults(results, store) {
var searchResults = document.getElementById('search-results');
if (results.length) { // Are there any results?
var appendString = '';
for (var i = 0; i < results.length; i++) { // Iterate over the results
var item = store[results[i].ref];
appendString += '<li><a href="' + item.url + '">' + item.title + '</a>';
appendString += '<p class="text-muted small">' + item.content.substring(0, 300) + '...</p></li>';
}
searchResults.innerHTML = appendString;
}
else {
searchResults.innerHTML = '<li>No results found. Try another search term.</li>';
}
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (pair[0] === variable) {
return decodeURIComponent(pair[1].replace(/\+/g, '%20'));
}
}
}
var searchTerm = getQueryVariable('q');
if (searchTerm) {
document.getElementById('search-box').setAttribute("value", searchTerm);
document.getElementById('search-term').innerText = searchTerm;
// Initalize lunr with the fields it will be searching on. I've given title
// a boost of 10 to indicate matches on this field are more important.
var idx = lunr(function () {
this.field('id');
this.field('title', { boost: 20 });
this.field('tags', { boost: 10 });
this.field('content');
});
for (var key in window.store) { // Add the data to lunr
idx.add({
'id': key,
'title': window.store[key].title,
'tags': window.store[key].tags,
'content': window.store[key].content
});
var results = idx.search(searchTerm); // Get lunr to perform a search
displaySearchResults(results, window.store); // We'll write this in the next section
}
}
else {
displaySearchResults([], window.store);
}
})();
</script>