Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add default document title and meta description #556

Merged
merged 2 commits into from
Nov 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions packages/saber/vue-app/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,29 @@ export default context => {
if (!htmlAttrs.lang) {
delete htmlAttrs.lang
}

const { title, description } = this.$siteConfig

const defaultMeta = [
{
name: 'generator',
content: `Saber v${__SABER_VERSION__}`
}
]
Copy link
Collaborator

@egoist egoist Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we don't need to set a default title and description. They're irrelevant to user's project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we don't need to set a default title and description. They're irrelevant to user's project.

Sorry for the delay, I will add conditional statements, check it again. :)


if (description) {
defaultMeta.push({
name: 'description',
content: description
})
}

return {
...head,
htmlAttrs,
title,
meta: [
{
name: 'generator',
content: `Saber v${__SABER_VERSION__}`
},
...defaultMeta,
...(head.meta || [])
]
}
Expand Down