assemble-goldcome-sitemap

0.0.5 • Public • Published

assemble-goldcome-sitemap NPM version 依赖模块状态

Assemble的Sitemap生成插件

Table of Contents

Quickstart

包安装:

npm install assemble-goldcome-sitemap --save

Gruntfile.js定制:

module.exports = function(grunt) {
 
  // Project configuration.
  grunt.initConfig({
    assemble: {
      options: {
        plugins: ['assemble-goldcome-sitemap']
      },
      ...
    }
  });
  grunt.loadNpmTasks('assemble');
  grunt.registerTask('default', ['assemble']);
};

Options

了解更多sitemap查看sitemaps.org

homepage

Type: String
Default: homepage (来自package.json)

Site URL

changefreq

Type: String

链接的更新频率选项,默认是文件中ymal定义的changefrq值,然后是选项option.changefre值,最后是weekly

  • always
  • hourly
  • daily
  • weekly
  • monthly
  • yearly
  • never

priority

Type: String

指定此链接相对于其他链接的优先权比值,此值定于0.0 - 1.0之间,默认是文件中ymal定义的priority值,然后是选项option.priority值,最后是0.5

exclusions

Type: Array
Default: ['404']

排除列表,默认是404页面。

options: {
  sitemap: {
    exclusions: ["foo", "bar"],
  },
  files: {
    ...
  }
}

robot

Type: Boolean
Default: true 生成robots.txt根据exclusions 列表。

relativedest: true

Type: Boolean

生成sitemap的相对路径开关,配合dest选项,输出路径相对于dest

dest

Type: String

生成sitemap的相对路径

sitemap

Type: Boolean Default: true 这个选项是在markdown文档中的,是否把该文档写入sitemap中,默认是true

Usage Examples

基本用法

最基本用法:

assemble: {
  blog: {
    options: {
      plugins: ['assemble-goldcome-sitemap'],
    },
    files: {
      './blog/': ['./templates/blog/*.hbs']
    }
  }
}
 

结果

./blog/sitemap.xml
./blog/robots.txt

高级

assemble: {
  blog: {
    options: {
      plugins: ['assemble-goldcome-sitemap'],
      sitemap: {
        homepage: 'http://www.gdcome.com',
            changefreq: 'daily',
            priority: '0.8',
            exclude: ['50x', 'foo'],
            robot: false,
            urldelete: 'test/'
      }
    },
    files: {
      './blog/': ['./templates/blog/*.hbs']
    }
  }
}

结果

./blog/sitemap.xml

Author

goldcome

Release History

  • 2014-02-18   v0.0.0   更具我的项目重构sitemap生成器
  • 2014-02-19   v0.0.1   修正robot选项失灵,默认false现在 增加drone持续集成测试
  • 2014-02-19   v0.0.2   robot修改为默认为true
  • 2014-02-21   v0.0.3   重构README.md文档模板 去除不必要的文件 增加sitemap选项,是否写入sitemap 重命名插件名称为index.js 用bootstrap完善测试模板
  • 2014-03-09   v0.0.4   拉取源gihub整合 priority也可以在page定义 为页面增加sitemap开关
  • 2014-03-09   v0.0.5   修正relativedest生成sitemap会覆盖问题

License

Copyright (c) 2014 goldcome, contributors. Released under the license


This file was generated on Sunday, March 9, 2014.

Package Sidebar

Install

npm i assemble-goldcome-sitemap

Weekly Downloads

1

Version

0.0.5

License

MIT

Last publish

Collaborators

  • goldcome