欢迎访问 gitbook-plugin-icp 官网 👋

npm:version npm:download npm:prerequisite github:documentation github:maintenance npm:license github:snodreams1006 website:snodreams1006.tech 微信公众号:雪之梦技术驿站-brightgreen.svg

用于在首页页脚区域添加 icp 网站备案信息的 Gitbook 插件

🏠 主页

屏幕截图

  • 多语言版本

icp-multilingual-index-use-preview.png

  • 单语言版本

icp-monolingual-index-use-preview.png

用法

步骤#1-更新book.json文件

  1. 在您的 gitbookbook.json 文件中,将 icp 添加到 plugins 列表中。
  2. pluginsConfig ,将 number 值设置为您自己的 icp 网站备案编号.
  3. pluginsConfig ,labellink 值是可选的,默认情况下,链接地址为 http://www.beian.miit.gov.cn/ .

这是最简单的示例:

{
    "plugins": ["icp"],
    "pluginsConfig": {
        "icp": {
            "number": "浙ICP备18042346号"
        }
    }
}

此外,受支持的配置选项如下:

"gitbook": {
  "properties": {
    "label": {
      "type": "string",
      "title": "icp label",
      "required": false
    },
    "number": {
      "type": "string",
      "title": "icp number",
      "required": true
    },
    "link": {
      "type": "string",
      "title": "link url",
      "required": false,
      "default": "http://www.beian.miit.gov.cn/"
    },
    "style": {
      "type": "object",
      "title": "icp number style",
      "required": false
    }
  }
}

步骤#2-gitbook命令

  1. 运行gitbook install .它将自动为您的 gitbook 安装 icp 插件.

该步骤仅需要允许一次即可.

gitbook install

或者您可以运行 npm install gitbook-plugin-icp 命令本地安装 gitbook-plugin-icp 插件.

npm install gitbook-plugin-icp
  1. 像往常一样构建您的书( gitbook build )或服务( gitbook serve ).
gitbook serve

示例

  • 官方文档配置文件

https://github.com/snowdreams1006/gitbook-plugin-icp/blob/master/docs/book.json

{
    "plugins": ["icp"],
    "pluginsConfig": {
        "icp": {
            "number": "浙ICP备18042346号"
        }
    }
}
  • 官方示例配置文件

https://github.com/snowdreams1006/gitbook-plugin-icp/blob/master/example/book.json

{
    "plugins": ["icp"],
    "pluginsConfig": {
        "icp": {
            "number": "浙ICP备18042346号"
        }
    }
}
  • 示例book.json文件
{
    "plugins": ["icp"],
    "pluginsConfig": {
        "icp": {
            "label": "YOUR OWN ICP LABEL",
            "number": "YOUR OWN ICP NUMBER",
            "link":"YOUR OWN ICP LINK"
        }
    }
}

或者,您可以添加 label 以自定义标签:

{
    "plugins": ["icp"],
    "pluginsConfig": {
        "icp": {
            "label": "YOUR OWN ICP LABEL",
            "number": "YOUR OWN ICP NUMBER",
            "link": "YOUR OWN ICP LINK"
        }
    }
}

或者您可以添加 link 以自定义链接:

{
    "plugins": ["icp"],
    "pluginsConfig": {
        "icp": {
            "label": "YOUR OWN ICP LABEL",
            "number": "YOUR OWN ICP NUMBER",
            "link": "YOUR OWN ICP LINK"
        }
    }
}

或者您可以添加 style 以自定义备案样式:

{
    "plugins": ["icp"],
    "pluginsConfig": {
        "icp": {
            "label": "YOUR OWN ICP LABEL",
            "number": "YOUR OWN ICP NUMBER",
            "link": "YOUR OWN ICP LINK",
            "style": {
              "color":  "#f72b07"
            }
        }
    }
}

注意 :如果您的书还没有创建,以上代码段可以用作完整的book.json文件.

作者

👤 snowdreams1006

贡献

欢迎提供文稿,问题和功能请求!
随时检查问题页面

表示支持

如果这个项目对您有帮助,请给个星星

版权

版权所有©2019 snowdreams1006

该项目是MIT许可的。

作者: 雪之梦技术驿站
链接: https://snowdreams1006.github.io/gitbook-plugin-icp/zh/
来源: 雪之梦技术驿站
本文原创发布于「雪之梦技术驿站」,转载请注明出处,谢谢合作!

https://snowdreams1006.github.io/snowdreams1006-wechat-open.png

results matching ""

    No results matching ""