Skip to content

Commit

Permalink
Do not assume addresses end with .html
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed May 23, 2024
1 parent 5c8ff8f commit 921c745
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 60 deletions.
3 changes: 1 addition & 2 deletions assets/js/handlebars/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ Handlebars.registerHelper('isEmptyArray', function (entry, options) {

Handlebars.registerHelper('isLocal', function (nodeId, options) {
const pathSuffix = window.location.pathname.split('/').pop()
const nodePage = nodeId + '.html'

if (nodePage === pathSuffix) {
if (pathSuffix === nodeId + '.html' || pathSuffix === nodeId) {
return options.fn(this)
} else {
return options.inverse(this)
Expand Down
3 changes: 2 additions & 1 deletion assets/js/search-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const SEARCH_CONTAINER_SELECTOR = '#search'
* Activates only on the `/search.html` page.
*/
export function initialize () {
if (window.location.pathname.endsWith('/search.html')) {
const pathname = window.location.pathname
if (pathname.endsWith('/search.html') || pathname.endsWith('/search')) {
const query = getQueryParamByName('q')
search(query)
}
Expand Down
4 changes: 3 additions & 1 deletion assets/js/sidebar/sidebar-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ function renderSidebarNodeList (nodesByType, type) {
clearCurrentSectionElement(previousSection)
}

if (anchor.matches('.expand') && anchor.pathname === window.location.pathname) {
if (anchor.matches('.expand') &&
(anchor.pathname === window.location.pathname ||
anchor.pathname === window.location.pathname + '.html')) {
openListItem(listItem)
}
})
Expand Down
56 changes: 0 additions & 56 deletions formatters/html/dist/html-BHYOTRCH.js

This file was deleted.

0 comments on commit 921c745

Please sign in to comment.