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

Add author property #41

Merged
merged 2 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
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: 22 additions & 0 deletions docs/modules/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Please read this resources before you enable `mobileAppIOS` option:
- Default: *npm_package_name*
- Meta: `title`

**author**
- Default: *npm_package_author_name*
- Meta: `author`

**description**
- Default: *npm_package_description*
- Meta: `description`
Expand All @@ -71,6 +75,24 @@ Please read this resources before you enable `mobileAppIOS` option:
- Default: same as options.description
- Meta: `og:description`

**ogHost**
Specify the domain that the site is hosted. Required for ogImage.
- Default: `undefined`
- Meta: `N/A`

**ogImage**
- Default: `true`
- Meta: `og:image` and sub-tags

These types are accepted:

- Boolean: the icons from the `icon` module are used.
- String: the path is used.
- Object:
* `path`: specify the path.
* `width`, `height`: specify the dimensions, respectively.
* `type`: specify the MIME type.

**nativeUI**
- Default: `false`

Expand Down
6 changes: 6 additions & 0 deletions packages/meta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function generateMeta (_options) {
// Defaults
const defaults = {
name: process.env.npm_package_name,
author: process.env.npm_package_author_name,
description: process.env.npm_package_description,
charset: 'utf-8',
viewport: undefined,
Expand Down Expand Up @@ -103,6 +104,11 @@ function generateMeta (_options) {
this.options.head.meta.push({ hid: 'apple-mobile-web-app-title', name: 'apple-mobile-web-app-title', content: title })
}

// Author
if (options.author && !find(this.options.head.meta, 'name', 'author')) {
this.options.head.meta.push({ hid: 'author', name: 'author', content: options.author })
}

// description meta
if (options.description && !find(this.options.head.meta, 'name', 'description')) {
this.options.head.meta.push({ hid: 'description', name: 'description', content: options.description })
Expand Down