This repository has been archived by the owner on Jun 13, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): support sitemap generation and improve SEO
- Loading branch information
Showing
42 changed files
with
363 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/docs/src/.vuepress/plugins/extra-seo/ExtraSeo.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template></template> | ||
|
||
<script> | ||
export default { | ||
created() { | ||
if (typeof this.$ssrContext !== "undefined") { | ||
const { domain } = this.$site.themeConfig | ||
const pagePath = this.$page.path.replace(/\.html$/, "") | ||
const url = path => `${domain}${path}` | ||
const lang = this.$lang.split('-')[0] | ||
// canonical | ||
this.$ssrContext.userHeadTags += `<link rel="canonical" href="${url(pagePath)}"/>`; | ||
// alternate | ||
let enPath; | ||
let esPath; | ||
if (pagePath.startsWith('/es/')) { | ||
enPath = pagePath.substring(3) | ||
esPath = pagePath | ||
} else { | ||
enPath = pagePath | ||
esPath = `/es${pagePath}` | ||
} | ||
this.$ssrContext.userHeadTags += `<link rel="alternate" href="${url(enPath)}" hreflang="en-US"/>`; | ||
this.$ssrContext.userHeadTags += `<link rel="alternate" href="${url(esPath)}" hreflang="es-US"/>`; | ||
// logo | ||
const logo = domain + require(`@assets/img/social-${lang}.png`) | ||
this.$ssrContext.userHeadTags += `<meta name="twitter:image" content="${logo}">`; | ||
this.$ssrContext.userHeadTags += `<meta property="og:image" content="${logo}">`; | ||
this.$ssrContext.userHeadTags += `<meta property="og:image:width" content="2136">`; | ||
this.$ssrContext.userHeadTags += `<meta property="og:image:height" content="1116">`; | ||
} | ||
} | ||
}; | ||
</script> |
5 changes: 5 additions & 0 deletions
5
packages/docs/src/.vuepress/plugins/extra-seo/enhanceAppFile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import ExtraSeo from './ExtraSeo.vue' | ||
|
||
export default ({ Vue, options }) => { | ||
Vue.component('ExtraSeo', ExtraSeo) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { path } = require('@vuepress/shared-utils') | ||
|
||
module.exports = options => ({ | ||
enhanceAppFiles () { | ||
return [path.resolve(__dirname, 'enhanceAppFile.js')] | ||
}, | ||
globalUIComponents: ['ExtraSeo'] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# redirect html pages | ||
/*.html /:splat/ 301 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<div itemscope itemtype="http://schema.org/Article"> | ||
<meta itemprop="dateCreated" :content="$page.frontmatter.date"> | ||
<meta itemprop="datePublished" :content="$page.frontmatter.date"> | ||
<meta itemprop="dateModified" :content="$page.lastUpdated"> | ||
<meta itemprop="headline" :content="$page.title"> | ||
<meta itemprop="description" :content="$page.frontmatter.description"> | ||
<meta itemprop="inLanguage" :content="language"> | ||
<meta itemprop="mainEntityOfPage" :content="$site.themeConfig.domain + $page.path"> | ||
<meta itemprop="image" :content="require(`@assets/img/social-${language}.png`)"> | ||
<meta itemprop="wordCount" :content="$page.readingTime.words"> | ||
<meta itemprop="timeRequired" :content="`PT${Math.ceil($page.readingTime.minutes)}M`"> | ||
<meta itemprop="license" content="https://github.com/bazzite/statusfy/blob/develop/LICENSE"> | ||
<meta itemprop="version" :content="$site.themeConfig.version"> | ||
<div itemscope itemprop="author" itemtype="http://schema.org/Organization"> | ||
<meta itemprop="legalName" content="Bazzite, LLC"> | ||
<meta itemprop="name" content="Bazzite"> | ||
<meta itemprop="url" content="https://www.bazzite.com"> | ||
</div> | ||
<div itemscope itemprop="publisher" itemtype="http://schema.org/Organization"> | ||
<meta itemprop="name" content="Statusfy"> | ||
<meta itemprop="url" content="https://statusfy.co"> | ||
<div itemscope itemscope itemprop="logo" itemtype="http://schema.org/ImageObject"> | ||
<meta itemprop="url" :content="require('@public/logo.png')"> | ||
<meta itemprop="width" content="512px"> | ||
<meta itemprop="height" content="512px"> | ||
</div> | ||
</div> | ||
|
||
<ParentPage :sidebarItems="sidebarItems" itemprop="articleBody" /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import ParentPage from '@parent-theme/components/Page.vue' | ||
export default { | ||
components: { | ||
ParentPage | ||
}, | ||
props: ['sidebarItems'], | ||
mounted() { | ||
console.log(this.$page) | ||
console.log(this.$site) | ||
}, | ||
computed: { | ||
language() { | ||
return this.$lang.split('-')[0]; | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
date: 2018-10-12T17:28:04Z | ||
home: true | ||
heroImage: /hero.bvdrsr4sre5.svg | ||
actionText: Get Started → | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
date: 2018-10-12T17:28:04Z | ||
home: true | ||
heroImage: /hero.bvdrsr4sre5.svg | ||
actionText: Empezemos → | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.