Skip to content

Commit

Permalink
correctly render page tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jfredrickson committed Apr 22, 2019
1 parent 1a2509a commit d9f21cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions assets/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@
const copy = '<p>' + page.body.substring(0, 200) + ' ...</p>';
let outputTags = '';
//loop through tags and parse
for(let tag in page.tags ){
outputTags += '<span class="usa-label">' + page.tags[tag] + '</span>';
const tags = Array.isArray(page.tags) ? page.tags : [page.tags];
for(let tag of tags ){
outputTags += '<span class="usa-label">' + tag + '</span>';
}

//final output for search
Expand Down

0 comments on commit d9f21cd

Please sign in to comment.