Skip to content

Commit

Permalink
add optional ignoreCase param and enable for page title
Browse files Browse the repository at this point in the history
  • Loading branch information
colegoldsmith committed May 3, 2024
1 parent 8807acf commit 625e5ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/helpers/includes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

module.exports = (searchValue, start) => {
module.exports = (searchValue, start, ignoreCase = false) => {
if (!searchValue || !start) return false
if (ignoreCase && typeof searchValue === 'string' && typeof start === 'string') {
searchValue = searchValue.toLowerCase()
start = start.toLowerCase()
}
return start.includes(searchValue)
}
2 changes: 1 addition & 1 deletion src/partials/head-title.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<title>{{{detag (or page.title defaultPageTitle)}}}{{#with page.component.title}}{{#if (not (includes this (or ../page.title ../defaultPageTitle)))}} | {{this}}{{/if}}{{/with}}{{#with site.title}} | {{this}}{{/with}}</title>
<title>{{{detag (or page.title defaultPageTitle)}}}{{#with page.component.title}}{{#if (not (includes this (or ../page.title ../defaultPageTitle) true))}} | {{this}}{{/if}}{{/with}}{{#with site.title}} | {{this}}{{/with}}</title>

0 comments on commit 625e5ee

Please sign in to comment.