diff --git a/app/assets/javascripts/related_tag.js b/app/assets/javascripts/related_tag.js index 69e68ad60..931dfd017 100644 --- a/app/assets/javascripts/related_tag.js +++ b/app/assets/javascripts/related_tag.js @@ -105,8 +105,14 @@ var $dest = $("#related-tags"); $dest.empty(); - $dest.append(this.build_html("recent", this.other_tags(Danbooru.Cookie.get("recent_tags_with_categories")))); - $dest.append(this.build_html("frequent", this.other_tags(Danbooru.Cookie.get("favorite_tags_with_categories")))); + var recent_tags = Danbooru.Cookie.get("recent_tags_with_categories"); + var favorite_tags = Danbooru.Cookie.get("favorite_tags_with_categories"); + if (recent_tags.length) { + $dest.append(this.build_html("recent", this.other_tags(recent_tags))); + } + if (favorite_tags.length) { + $dest.append(this.build_html("frequent", this.other_tags(favorite_tags))); + } $dest.append(this.build_html(query, related_tags)); if (wiki_page_tags.length) { $dest.append(Danbooru.RelatedTag.build_html("wiki:" + query, wiki_page_tags));