Skip to content

Commit

Permalink
fix: removed double check
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Faggin committed Sep 20, 2019
1 parent 03ca25c commit fe67f00
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/amp/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ const createCustomHead = originalHead => function customHead () {
*/
ensureKey(head, 'link', [])

// Add canonical meta only if page is served as AMP
if (this.$ampMode !== false && this.$isAMP === true) {
/**
* Add canonical meta and AMP requirement if page is served as AMP
*/
if (this.$isAMP) {
if (origin && !head.link.find(l => l.rel === 'canonical' || l.hid === 'canonical')) {
const path = this.$isAMP && this.$ampMode !== 'only'
? this.$route.fullPath.replace(/^\/amp(\/.*)?/, '$1')
Expand All @@ -107,12 +109,7 @@ const createCustomHead = originalHead => function customHead () {
href: origin + path
})
}
}

/**
* add amp requirement if page is served as AMP
*/
if (this.$isAMP) {
ensureKey(head, 'htmlAttrs', {})

if (vueMetaMajor >= 2) {
Expand Down

0 comments on commit fe67f00

Please # to comment.