mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-24 07:30:12 +01:00
Fixed crash after navigation caused 404 when using instant loading
This commit is contained in:
parent
dfa5f03138
commit
494cae1e36
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -249,7 +249,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.aecac24b.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.a1c919d2.min.js' | url }}"></script>
|
||||
{% for script in config.extra_javascript %}
|
||||
{{ script | script_tag }}
|
||||
{% endfor %}
|
||||
|
@ -47,7 +47,6 @@ import {
|
||||
import { configuration, feature } from "~/_"
|
||||
import {
|
||||
Viewport,
|
||||
getElement,
|
||||
getElements,
|
||||
getLocation,
|
||||
getOptionalElement,
|
||||
@ -89,8 +88,9 @@ function lookup(head: HTMLHeadElement): Map<string, HTMLElement> {
|
||||
// resolution. The next time we refactor instant loading, we should use the
|
||||
// location subject as a source, which is also used for anchor links tracking,
|
||||
// but for now we just rely on canonical.
|
||||
const canonical = getElement<HTMLLinkElement>("[rel=canonical]", head)
|
||||
canonical.href = canonical.href.replace("//localhost:", "//127.0.0.1")
|
||||
const canonical = getOptionalElement<HTMLLinkElement>("[rel=canonical]", head)
|
||||
if (typeof canonical !== "undefined")
|
||||
canonical.href = canonical.href.replace("//localhost:", "//127.0.0.1")
|
||||
|
||||
// Create tag map and index elements in head
|
||||
const tags = new Map<string, HTMLElement>()
|
||||
@ -107,7 +107,7 @@ function lookup(head: HTMLHeadElement): Map<string, HTMLElement> {
|
||||
continue
|
||||
|
||||
// Resolve URL relative to current location
|
||||
const url = new URL(value, canonical.href)
|
||||
const url = new URL(value, canonical?.href)
|
||||
const ref = el.cloneNode() as HTMLElement
|
||||
|
||||
// Set resolved URL and retrieve HTML for deduplication
|
||||
|
Loading…
Reference in New Issue
Block a user