Skip to content

Commit

Permalink
fix: certain articles not correctly identified as having platform spe…
Browse files Browse the repository at this point in the history
…cific content (github#22887)
  • Loading branch information
mikesurowiec authored Nov 16, 2021
1 parent 6dbd1c8 commit 9952744
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,16 @@ class Page {
})
}

// set a flag so layout knows whether to render a mac/windows/linux switcher element
this.includesPlatformSpecificContent =
html.includes('extended-markdown mac') ||
html.includes('extended-markdown windows') ||
html.includes('extended-markdown linux')

this.detectedPlatforms = [
html.includes('extended-markdown mac') && 'mac',
html.includes('extended-markdown windows') && 'windows',
html.includes('extended-markdown linux') && 'linux',
(html.includes('extended-markdown mac') || html.includes('platform-mac')) && 'mac',
(html.includes('extended-markdown windows') || html.includes('platform-windows')) &&
'windows',
(html.includes('extended-markdown linux') || html.includes('platform-linux')) && 'linux',
].filter(Boolean)

// set a flag so layout knows whether to render a mac/windows/linux switcher element
this.includesPlatformSpecificContent = this.detectedPlatforms.length > 0

return html
}

Expand Down

0 comments on commit 9952744

Please sign in to comment.