diff --git a/godoc/static/static.go b/godoc/static/static.go
index 2d5fbe40..a024ca09 100644
--- a/godoc/static/static.go
+++ b/godoc/static/static.go
@@ -878,7 +878,7 @@ function updateVersionTags() {
function addPermalinks() {
function addPermalink(source, parent) {
var id = source.attr("id");
- if (id.indexOf("tmp_") === 0) {
+ if (id == "" || id.indexOf("tmp_") === 0) {
// Auto-generated permalink.
return;
}
@@ -886,7 +886,7 @@ function addPermalinks() {
// Already attached.
return;
}
- parent.append(" ").append($(" ¶").attr("href", "#" + id));
+ parent.append(" ").append($("¶").attr("href", "#" + id));
}
$("#page .container").find("h2[id], h3[id]").each(function() {