Fix pinned post URL on single-user instances
Previously, the URL of the dynamically-added pinned post on a single-user instance would include the username, causing the link to go to a non-existent page. This fixes that.
This commit is contained in:
parent
a48b746706
commit
f6dc07850b
|
@ -141,7 +141,7 @@ function pinPost(e, postID, slug, title) {
|
||||||
var $header = document.getElementsByTagName('header')[0];
|
var $header = document.getElementsByTagName('header')[0];
|
||||||
var $pinnedNavs = $header.getElementsByTagName('nav');
|
var $pinnedNavs = $header.getElementsByTagName('nav');
|
||||||
// Add link to nav
|
// Add link to nav
|
||||||
var link = '<a class="pinned" href="/{{.Alias}}/'+slug+'">'+title+'</a>';
|
var link = '<a class="pinned" href="{{if not .SingleUser}}/{{.Alias}}/{{end}}'+slug+'">'+title+'</a>';
|
||||||
if ($pinnedNavs.length == 0) {
|
if ($pinnedNavs.length == 0) {
|
||||||
$header.insertAdjacentHTML("beforeend", '<nav>'+link+'</nav>');
|
$header.insertAdjacentHTML("beforeend", '<nav>'+link+'</nav>');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -176,7 +176,7 @@ function pinPost(e, postID, slug, title) {
|
||||||
var $header = document.getElementsByTagName('header')[0];
|
var $header = document.getElementsByTagName('header')[0];
|
||||||
var $pinnedNavs = $header.getElementsByTagName('nav');
|
var $pinnedNavs = $header.getElementsByTagName('nav');
|
||||||
// Add link to nav
|
// Add link to nav
|
||||||
var link = '<a class="pinned" href="/{{.Alias}}/'+slug+'">'+title+'</a>';
|
var link = '<a class="pinned" href="{{if not .SingleUser}}/{{.Alias}}/{{end}}'+slug+'">'+title+'</a>';
|
||||||
if ($pinnedNavs.length == 0) {
|
if ($pinnedNavs.length == 0) {
|
||||||
$header.insertAdjacentHTML("beforeend", '<nav>'+link+'</nav>');
|
$header.insertAdjacentHTML("beforeend", '<nav>'+link+'</nav>');
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue