Plain text
\n \n\n```\n\n# 图片 Images\n\nImage:\n\n![](https://pandao.github.io/editor.md/examples/images/4.jpg)\n\n> Follow your heart.\n\n![](https://pandao.github.io/editor.md/examples/images/8.jpg)\n\n> 图为:厦门白城沙滩\n\n图片加链接 (Image + Link):\n\n[![](https://pandao.github.io/editor.md/examples/images/7.jpg)](https://pandao.github.io/editor.md/images/7.jpg \"李健首张专辑《似水流年》封面\")\n\n> 图为:李健首张专辑《似水流年》封面\n \n----\n\n# 列表 Lists\n\n## 无序列表(减号)Unordered Lists (-)\n \n- 列表一\n- 列表二\n- 列表三\n \n## 无序列表(星号)Unordered Lists (*)\n\n* 列表一\n* 列表二\n* 列表三\n\n## 无序列表(加号和嵌套)Unordered Lists (+)\n \n+ 列表一\n+ 列表二\n + 列表二-1\n + 列表二-2\n + 列表二-3\n+ 列表三\n * 列表一\n * 列表二\n * 列表三\n\n## 有序列表 Ordered Lists (-)\n \n1. 第一行\n2. 第二行\n3. 第三行\n\n## GFM task list\n\n- [x] GFM task list 1\n- [x] GFM task list 2\n- [ ] GFM task list 3\n - [ ] GFM task list 3-1\n - [ ] GFM task list 3-2\n - [ ] GFM task list 3-3\n- [ ] GFM task list 4\n - [ ] GFM task list 4-1\n - [ ] GFM task list 4-2\n \n----\n \n# 绘制表格 Tables\n\n| 项目 | 价格 | 数量 |\n| ------ | ----: | :---: |\n| 计算机 | $1600 | 5 |\n| 手机 | $12 | 12 |\n| 管线 | $1 | 234 |\n \n| First Header | Second Header |\n| ------------ | ------------- |\n| Content Cell | Content Cell |\n| Content Cell | Content Cell |\n\n| First Header | Second Header |\n| ------------ | ------------- |\n| Content Cell | Content Cell |\n| Content Cell | Content Cell |\n\n| Function name | Description |\n| ------------- | -------------------------- |\n| `help()` | Display the help window. |\n| `destroy()` | **Destroy your computer!** |\n\n| Left-Aligned | Center Aligned | Right Aligned |\n| :------------ | :-------------: | ------------: |\n| col 3 is | some wordy text | $1600 |\n| col 2 is | centered | $12 |\n| zebra stripes | are neat | $1 |\n\n| Item | Value |\n| -------- | ----: |\n| Computer | $1600 |\n| Phone | $12 |\n| Pipe | $1 |\n \n# 科学公式 TeX(KaTeX)\n\n$$E=mc^2$$\n\n$$x > y$$\n\n$$\\(\\sqrt{3x-1}+(1+x)^2\\)$$\n \n$$\\sin(\\alpha)^{\\theta}=\\sum_{i=0}^{n}(x^i + \\cos(f))$$\n\n\n# 绘制流程图 mermaid\n\n{% mermaid %}\ngraph TD;\n A --> B;\n A --> C;\n B --> D;\n C --> D;\n{% endmermaid %}\n\n \n \nEnd","source":"_posts/Markdown Sample.md","raw":"---\ntitle: Markdown Sample\ndescription: A very simple way to add structured data to a page.\nstatus: done\ntop: 0\ncategories: \n- Hexo\nkeywords: \"Markdown, 代码高亮 (Codes), 引用 (Blockquotes), 列表 (Lists), 图片 (Images), 表格 (Tables), Emoji, TeX(KaTeX), 流程图 (mermaid)\"\n---\n\n# Linear Markdown Sample\n\n![markdown](https://pandao.github.io/editor.md/images/logos/editormd-logo-180x180.png)\n\n\n# Heading 1 link [Heading link](https://github.com/pandao/editor.md \"Heading link\")\n## Heading 2 link [Heading link](https://github.com/pandao/editor.md \"Heading link\")\n### Heading 3 link [Heading link](https://github.com/pandao/editor.md \"Heading link\")\n#### Heading 4 link [Heading link](https://github.com/pandao/editor.md \"Heading link\") Heading link [Heading link](https://github.com/pandao/editor.md \"Heading link\")\n##### Heading 5 link [Heading link](https://github.com/pandao/editor.md \"Heading link\")\n###### Heading 6 link [Heading link](https://github.com/pandao/editor.md \"Heading link\")\n\n\n\n# 字符效果和横线等\n \n----\n\n~~删除线~~Plain text
\n \n\n```\n\n# 图片 Images\n\nImage:\n\n![](https://pandao.github.io/editor.md/examples/images/4.jpg)\n\n> Follow your heart.\n\n![](https://pandao.github.io/editor.md/examples/images/8.jpg)\n\n> 图为:厦门白城沙滩\n\n图片加链接 (Image + Link):\n\n[![](https://pandao.github.io/editor.md/examples/images/7.jpg)](https://pandao.github.io/editor.md/images/7.jpg \"李健首张专辑《似水流年》封面\")\n\n> 图为:李健首张专辑《似水流年》封面\n \n----\n\n# 列表 Lists\n\n## 无序列表(减号)Unordered Lists (-)\n \n- 列表一\n- 列表二\n- 列表三\n \n## 无序列表(星号)Unordered Lists (*)\n\n* 列表一\n* 列表二\n* 列表三\n\n## 无序列表(加号和嵌套)Unordered Lists (+)\n \n+ 列表一\n+ 列表二\n + 列表二-1\n + 列表二-2\n + 列表二-3\n+ 列表三\n * 列表一\n * 列表二\n * 列表三\n\n## 有序列表 Ordered Lists (-)\n \n1. 第一行\n2. 第二行\n3. 第三行\n\n## GFM task list\n\n- [x] GFM task list 1\n- [x] GFM task list 2\n- [ ] GFM task list 3\n - [ ] GFM task list 3-1\n - [ ] GFM task list 3-2\n - [ ] GFM task list 3-3\n- [ ] GFM task list 4\n - [ ] GFM task list 4-1\n - [ ] GFM task list 4-2\n \n----\n \n# 绘制表格 Tables\n\n| 项目 | 价格 | 数量 |\n| ------ | ----: | :---: |\n| 计算机 | $1600 | 5 |\n| 手机 | $12 | 12 |\n| 管线 | $1 | 234 |\n \n| First Header | Second Header |\n| ------------ | ------------- |\n| Content Cell | Content Cell |\n| Content Cell | Content Cell |\n\n| First Header | Second Header |\n| ------------ | ------------- |\n| Content Cell | Content Cell |\n| Content Cell | Content Cell |\n\n| Function name | Description |\n| ------------- | -------------------------- |\n| `help()` | Display the help window. |\n| `destroy()` | **Destroy your computer!** |\n\n| Left-Aligned | Center Aligned | Right Aligned |\n| :------------ | :-------------: | ------------: |\n| col 3 is | some wordy text | $1600 |\n| col 2 is | centered | $12 |\n| zebra stripes | are neat | $1 |\n\n| Item | Value |\n| -------- | ----: |\n| Computer | $1600 |\n| Phone | $12 |\n| Pipe | $1 |\n \n# 科学公式 TeX(KaTeX)\n\n$$E=mc^2$$\n\n$$x > y$$\n\n$$\\(\\sqrt{3x-1}+(1+x)^2\\)$$\n \n$$\\sin(\\alpha)^{\\theta}=\\sum_{i=0}^{n}(x^i + \\cos(f))$$\n\n\n# 绘制流程图 mermaid\n\n{% mermaid %}\ngraph TD;\n A --> B;\n A --> C;\n B --> D;\n C --> D;\n{% endmermaid %}\n\n \n \nEnd","slug":"Markdown Sample","published":1,"date":"2023-10-23T04:01:13.108Z","updated":"2023-10-23T04:01:13.108Z","comments":1,"layout":"post","photos":[],"link":"","_id":"cloi8dca00002edz398bnea4t","content":"删除线 删除线(开启识别HTML标签时)
斜体字 斜体字
粗体 粗体
粗斜体 粗斜体
上标:X2,下标:O2
\n缩写(同HTML的abbr标签)
\n\n\n即更长的单词或短语的缩写形式,前提是开启识别HTML标签时,已默认开启
\n
The HTML specification is maintained by the W3C.
\n\n\n引用文本 Blockquotes
\n
引用的行内混合 Blockquotes
\n\n\n引用:如果想要插入空白换行
\n即<br />标签
,在插入处先键入两个以上的空格然后回车即可,普通链接。
直接链接:https://github.com
\n\n\n\nGFM a-tail link @pandao 邮箱地址自动链接 test.test@gmail.com www@vip.qq.com
\n\n\n@pandao
\n
执行命令:npm install marked
function test() {\n\tconsole.log(\"Hello world!\");\n}\n \n(function(){\n var box = function() {\n return box.fn.init();\n };\n\n box.prototype = box.fn = {\n init : function(){\n console.log('box.init()');\n\n\t\t\treturn this;\n },\n\n\t\tadd : function(str) {\n\t\t\talert(\"add\", str);\n\n\t\t\treturn this;\n\t\t},\n\n\t\tremove : function(str) {\n\t\t\talert(\"remove\", str);\n\n\t\t\treturn this;\n\t\t}\n };\n \n box.fn.init.prototype = box.fn;\n \n window.box =box;\n})();\n\nvar testBox = box();\ntestBox.add(\"jQuery\").remove(\"jQuery\");
\n\n<!DOCTYPE html>\n<html>\n <head>\n <mate charest=\"utf-8\" />\n <meta name=\"keywords\" content=\"Editor.md, Markdown, Editor\" />\n <title>Hello world!</title>\n <style type=\"text/css\">\n body{font-size:14px;color:#444;font-family: \"Microsoft Yahei\", Tahoma, \"Hiragino Sans GB\", Arial;background:#fff;}\n ul{list-style: none;}\n img{border:none;vertical-align: middle;}\n </style>\n </head>\n <body>\n <h1 class=\"text-xxl\">Hello world!</h1>\n <p class=\"text-green\">Plain text</p>\n </body>\n</html>
\n\nImage:
\n\n\n\n\nFollow your heart.
\n
\n\n图为:厦门白城沙滩
\n
图片加链接 (Image + Link):
\n\n\n\n图为:李健首张专辑《似水流年》封面
\n
项目 | \n价格 | \n数量 | \n
---|---|---|
计算机 | \n$1600 | \n5 | \n
手机 | \n$12 | \n12 | \n
管线 | \n$1 | \n234 | \n
First Header | \nSecond Header | \n
---|---|
Content Cell | \nContent Cell | \n
Content Cell | \nContent Cell | \n
First Header | \nSecond Header | \n
---|---|
Content Cell | \nContent Cell | \n
Content Cell | \nContent Cell | \n
Function name | \nDescription | \n
---|---|
help() | \nDisplay the help window. | \n
destroy() | \nDestroy your computer! | \n
Left-Aligned | \nCenter Aligned | \nRight Aligned | \n
---|---|---|
col 3 is | \nsome wordy text | \n$1600 | \n
col 2 is | \ncentered | \n$12 | \n
zebra stripes | \nare neat | \n$1 | \n
Item | \nValue | \n
---|---|
Computer | \n$1600 | \n
Phone | \n$12 | \n
Pipe | \n$1 | \n
$$E=mc^2$$
\n$$x > y$$
\n$$(\\sqrt{3x-1}+(1+x)^2)$$
\n$$\\sin(\\alpha)^{\\theta}=\\sum_{i=0}^{n}(x^i + \\cos(f))$$
\nEnd
\n","site":{"data":{}},"excerpt":"","more":"删除线 删除线(开启识别HTML标签时)
斜体字 斜体字
粗体 粗体
粗斜体 粗斜体
上标:X2,下标:O2
\n缩写(同HTML的abbr标签)
\n\n\n即更长的单词或短语的缩写形式,前提是开启识别HTML标签时,已默认开启
\n
The HTML specification is maintained by the W3C.
\n\n\n引用文本 Blockquotes
\n
引用的行内混合 Blockquotes
\n\n\n引用:如果想要插入空白换行
\n即<br />标签
,在插入处先键入两个以上的空格然后回车即可,普通链接。
直接链接:https://github.com
\n\n\n\nGFM a-tail link @pandao 邮箱地址自动链接 test.test@gmail.com www@vip.qq.com
\n\n\n@pandao
\n
执行命令:npm install marked
function test() {\n\tconsole.log(\"Hello world!\");\n}\n \n(function(){\n var box = function() {\n return box.fn.init();\n };\n\n box.prototype = box.fn = {\n init : function(){\n console.log('box.init()');\n\n\t\t\treturn this;\n },\n\n\t\tadd : function(str) {\n\t\t\talert(\"add\", str);\n\n\t\t\treturn this;\n\t\t},\n\n\t\tremove : function(str) {\n\t\t\talert(\"remove\", str);\n\n\t\t\treturn this;\n\t\t}\n };\n \n box.fn.init.prototype = box.fn;\n \n window.box =box;\n})();\n\nvar testBox = box();\ntestBox.add(\"jQuery\").remove(\"jQuery\");
\n\n<!DOCTYPE html>\n<html>\n <head>\n <mate charest=\"utf-8\" />\n <meta name=\"keywords\" content=\"Editor.md, Markdown, Editor\" />\n <title>Hello world!</title>\n <style type=\"text/css\">\n body{font-size:14px;color:#444;font-family: \"Microsoft Yahei\", Tahoma, \"Hiragino Sans GB\", Arial;background:#fff;}\n ul{list-style: none;}\n img{border:none;vertical-align: middle;}\n </style>\n </head>\n <body>\n <h1 class=\"text-xxl\">Hello world!</h1>\n <p class=\"text-green\">Plain text</p>\n </body>\n</html>
\n\nImage:
\n\n\n\n\nFollow your heart.
\n
\n\n图为:厦门白城沙滩
\n
图片加链接 (Image + Link):
\n\n\n\n图为:李健首张专辑《似水流年》封面
\n
项目 | \n价格 | \n数量 | \n
---|---|---|
计算机 | \n$1600 | \n5 | \n
手机 | \n$12 | \n12 | \n
管线 | \n$1 | \n234 | \n
First Header | \nSecond Header | \n
---|---|
Content Cell | \nContent Cell | \n
Content Cell | \nContent Cell | \n
First Header | \nSecond Header | \n
---|---|
Content Cell | \nContent Cell | \n
Content Cell | \nContent Cell | \n
Function name | \nDescription | \n
---|---|
help() | \nDisplay the help window. | \n
destroy() | \nDestroy your computer! | \n
Left-Aligned | \nCenter Aligned | \nRight Aligned | \n
---|---|---|
col 3 is | \nsome wordy text | \n$1600 | \n
col 2 is | \ncentered | \n$12 | \n
zebra stripes | \nare neat | \n$1 | \n
Item | \nValue | \n
---|---|
Computer | \n$1600 | \n
Phone | \n$12 | \n
Pipe | \n$1 | \n
$$E=mc^2$$
\n$$x > y$$
\n$$(\\sqrt{3x-1}+(1+x)^2)$$
\n$$\\sin(\\alpha)^{\\theta}=\\sum_{i=0}^{n}(x^i + \\cos(f))$$
\nEnd
\n"},{"title":"Cosy 入门","top":2,"status":"doing","_content":"\n# Hexo 安装主题\n\n`Hexo` 主题的安装方式非常简单,只需将主题 `Hexo-theme-cosy` 复制目录的 `themes` 目录下,然后在 `Hexo` 的 `_config.yml` 中修改下主题配置即可\n\n```yml\n# 找到 theme 配置项\ntheme: Hexo-theme-cosy\n```\n\n## 获取 Cosy\n\n- 进入 [Cosy 代码仓库](https://github.com/17px/hexo-theme-cosy/tree/main),了解最新的主题开发进度\n- 在 [发布页面](https://github.com/17px/hexo-theme-cosy/releases) 下载 `hexo-theme-cosy.zip`\n- 解压至站点的 `themes` 目录下\n- 在 Hexo 的 `_config.yml` 中启用\n\n# hexo配置\n\n在 `Hexo` 的 `_config.yml` 中调整\n\n## 基础配置\n\n```yml\n# 网页标题\ntitle: 17px blog\n# 侧边栏顶部显示\nsubtitle: \"Mozzie\"\n# 用于SEO的html元描述\ndescription: \"\"\n# 用于SEO的html关键字\nkeywords:\n# 文章版权声明显示作者名称\nauthor: Mozzie\n\n# 在此处设置您的网站url\nurl: https://mozzie.cn\n```\n\n## 语言\n\n你可以在 `hexo-theme-cosy/languages` 中找到不同的语言文件,如果想切换语言,在配置文件中,填入 `yml` 的文件名\n\n```yml\nlanguage: en\n```\n\n## 文章语法高亮\n\n关闭hexo默认的highlight.js语法高亮\n\n```yml\nhighlight:\n enable: false\n line_number: true\n auto_detect: false\n tab_replace: \"\"\n wrap: true\n hljs: false\n\nprismjs:\n enable: true\n preprocess: true\n line_number: true\n line_threshold: 0\n tab_replace: \"\"\n```\n\n# Cosy 主题配置\n\n下面的配置基于 `Hexo-theme-cosy` 下的 `_config.yml` \n\n## 文章分类图标\n\n按照顺序,依次设置 `svg` 图标,可以在 [xicon](https://www.xicons.org/) 方面的获取丰富的图标\n\n```yml\npostCategoryIcons:\n - \n - \n - \n```\n\n## 网站图标 favicon\n\n- 支持 `svg`\n- 支持 `图片url`,如:`/img/favicon.png`\n\n```yml\nfavicon: ''\n```\n\n## ICP备案号\n\n😁 如不需要备案号,可直接删除\n\n```yml\nicp: 苏ICP备xxxxxxx号-x\n```\n\n## 首页底部文字\n\n😁 如不需要,可直接删除,或者改为 `false` \n\n```yml\nmotto: false\n```\n\n## 文章版权申明\n\n默认开启,当 `enable: false`,默认关闭\n\n```yml\npostCopyright:\n enable: true\n license: CC BY-NC-SA 4.0\n license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/\n```\n\n## katex 数学公式\n\n可自行配置 `cdn`\n\n```yml\nkatex:\n enable: true\n jsCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.js\n cssCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.css\n```\n\n## mermaid 流程图\n\n在撰写时,请使用 `{% mermaid %}` 和 `{% endmermaid %}` 包裹\n\n```markdown\n{% mermaid %}\ngraph TD;\n A --> B;\n A --> C;\n B --> D;\n C --> D;\n{% endmermaid %}\n```\n\n相应配置如下\n\n```yml\nmermaid:\n enable: true\n cdn: //cdn.jsdelivr.net/npm/mermaid@10.4.0/dist/mermaid.min.js\n```\n\n## valine 文章评论\n\n首先需要注册 `LeanCloud` 国际区用户,创建数据库\n\n请根据相关地区法规,酌情\n\n```yml\nvaline:\n enable: true\n # 替换\n appId: appId\n # 替换\n appKey: appKey\n avatar: monsterid\n cdn: //unpkg.com/valine@latest/dist/Valine.min.js\n # 替换\n serverURLs: //xxxxxxxx.api.lncldglobal.com\n```\n\n# algolia搜索\n\n博客自带的本地搜索,基于前端开发,存在或多或少的问题,建议换成 `algolia`,免费账户 总共有 `10,000` 条记录,每月有 `100,000` 的操作数\n\n## 注册 & 获取 Key\n\n1. 创建一个新的 `Index`,例如 `hex-blog`\n\n2. 复制并保存:\n - Application ID\n - Search-Only API Key\n - Admin API Key\n - Usage API Key\n\n![API Keys](/img/algolia-api-keys.png)\n\n3. 替换配置\n\n在 `Hexo` 的 `_config.yml` 中加入\n\n```yml\nalgolia:\n # 替换\n appId: Application ID\n # 替换\n apiKey: Usage API Key\n # 请勿泄露,用于上报,替换\n adminApiKey: Admin API Key\n # 替换\n SearchOnlyAPIKey: Search-Only API Key\n chunkSize: 5000\n # 替换\n indexName: hex-blog\n fields:\n - content:strip\n - categories\n - date\n - permalink\n - slug\n - tags\n - title\n```\n\n## 安装 hexo-algoliasearch\n\n这是 Hexo 博客帖子索引插件,自动化提交索引到 Algolia\n\n> 如出遇到问题,可阅读 [hexo-algoliasearch 仓库](https://www.npmjs.com/package/hexo-algoliasearch) 最新说明\n\n安装命令:\n\n```bash\nnpm install hexo-algoliasearch --save\n```\n\n## 使用 algolia\n\n在每次博客发布之前,进行索引上传的操作,命令通常如下\n\n```bash\nhexo clean\nhexo generate\nhexo algolia\n``` \n\n\n# 🇨🇳 和风天气 Widget\n\nCosy 主要针对国内用户,在首页集成了和风天气的卡片,通过 [和风天气开发服务](https://dev.qweather.com/docs/start/) 注册\n\n注册完成后,在配置中填入你的 `appKey` 和 `cityCode(城市代码)`\n\n```yml\nweather:\n enable: true\n # 替换\n cityCode: cityCode\n appKey: appKey\n```\n\n其中 `cityCode` 可以在 [官方的地区列表仓库](https://github.com/qwd/LocationList) 中的 `China-City-List-latest.csv` 找到你所在城市的 `cityCode`\n\n# 前置元数据\n\n在 Hexo 的 Markdown 文件中,一个典型的 YAML 格式的 `Front Matter` 可能会是这样的:\n\n```markdown\n---\ntitle: 我的文章标题\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n## top\n\n实现文章置顶的功能,给定一个数值,可以进行排序,设定了 `top` 元数据的文章,会在分类列表中,使用 📌 标记\n\n例如有三篇文章:\n\n- 文章1\n\n```markdown\n---\ntitle: 文章1\ntop: 0\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n- 文章2\n\n```markdown\n---\ntitle: 文章2\ntop: 1\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n- 文章3\n\n```markdown\n---\ntitle: 文章3\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n那么在 `javascript` 分类下,排序的顺序依次为:`文章1 > 文章2 > 文章3`\n\n## status\n\n用于区分文章的状态,同时利用文章分类列表的`筛选`,进行快速筛选,Cosy 主题内置了 4 种状态\n\n- done:完成\n- doing:进行中\n- todo:待办\n- other:废弃\n\n例如:\n\n```markdown\n---\ntitle: 文章1\ncategories:\n- javascript\nstatus: done\n---\n```\n\n# 自定义页面\n\nHexo 使用 Markdown(或其他渲染引擎)解析你的文章,并生成静态文件以快速加载。除了默认生成的文章和归档页面之外,Hexo 还允许你创建自定义页面。\n\n## Roadmap路线图\n\n创建页面,你可以使用命令\n\n```bash\nhexo new page roadmap\n```\n\n成功后在 `source/` 文件夹下会生成一个新的文件夹 `/roadmap/index.md`\n\n你可以参照此模板,进行配置,参数说明:\n\n- title: roadmap页面 html 的标题\n- initYear: 默认显示的年份\n\n```markdown\n---\ntitle: 陈不渡 - roadmap\nlayout: roadmap\ninitYear: 2023\nyears:\n 2022:\n - title: 读书\n start: 01-01\n end: 1-5\n - title: 还是读书\n start: 02-01\n end: 05-30\n 2023:\n - title: 越陌度阡\n start: 01-01\n end: 1-2\n - title: 枉用相存\n start: 02-01\n end: 06-30\n - title: 短歌行\n start: 10-26\n end: 10-31\n content: 对酒当歌,人生几何!譬如朝露,去日苦多。慨当以慷,忧思难忘。何以解忧?唯有杜康。青青子衿,悠悠我心。但为君故,沉吟至今。呦呦鹿鸣,食野之苹。\n - title: 声律启蒙\n start: 11-01\n end: 11-31\n content: 花开红锦绣,水漾碧琉璃。去妇因探邻舍枣,出妻为种后园葵\n---\n```\n\n## Resume简历页面\n\n创建页面,你可以使用命令\n\n```bash\nhexo new page resume\n```\n\n成功后在 `source/` 文件夹下会生成一个新的文件夹 `/resume/index.md`\n\n你可以参照此模板,进行配置,参数说明:\n\n- title: resume 页面 html 的标题\n- avatar: 头像图片的地址\n\n```yml\ntitle: 页面标题document.title\nlayout: resume\navatar: /img/avatar.png\nname: Hi! Mozzie\nrole: Full Stack\nemail: himozzie@gmail.com\nphone: +86 180-xxxx-xxx\nbirth: Jan 21, 1994\nlocation: Nanjing, China\nsocial:\n - name: github\n link: https://github.com/17px\n icon: svg\n\nabout:\n - 我的工作是建立你的网站,使其功能强大,用户友好,但同时具有吸引力。\n - 此外,我为您的产品添加了个人风格,并确保其引人注目且易于使用。我的目标是以最有创意的方式传达你的信息和身份。我为许多知名品牌公司设计网页。\n\nskill:\n - 熟悉Node,具备后端开发能力,有SpringBoot、Egg、Koa2、Midway等单个应用项目经验,有Nestjs微服务应用项目经验\n - 具有Monoreo工程经验,能够分离单个单元的前端和后端并应用DevOps\n\neducation:\n - school: 大学艺术学院\n time: 2012-2016\n\nworkExp:\n - inc: 创意研发\n time: 2021.09 ~ 至今\n - inc: Web设计\n time: 2021.01 ~ 2021.09\n\nprojectExp:\n - name: PC/React• 标注 ,算法数据中心\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n list: \n - 使用pnpm工作区管理Monorepo中的多个代码库,支持多个框架共存,共享通用组件库和功能\n\n - name: PC/React•Tavigator主动脉根部/外周\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n\n\nportfolio:\n - name: 项目A\n desc: 项目A描述\n iconSVG: 复制svg的path到这里\n link: 网址,http(s)://...\n # 更多 ...\n\n```","source":"_posts/Cosy-Starter-Guide.md","raw":"---\ntitle: Cosy 入门\ntop: 2\ncategories:\n - Hexo\nstatus: doing\n---\n\n# Hexo 安装主题\n\n`Hexo` 主题的安装方式非常简单,只需将主题 `Hexo-theme-cosy` 复制目录的 `themes` 目录下,然后在 `Hexo` 的 `_config.yml` 中修改下主题配置即可\n\n```yml\n# 找到 theme 配置项\ntheme: Hexo-theme-cosy\n```\n\n## 获取 Cosy\n\n- 进入 [Cosy 代码仓库](https://github.com/17px/hexo-theme-cosy/tree/main),了解最新的主题开发进度\n- 在 [发布页面](https://github.com/17px/hexo-theme-cosy/releases) 下载 `hexo-theme-cosy.zip`\n- 解压至站点的 `themes` 目录下\n- 在 Hexo 的 `_config.yml` 中启用\n\n# hexo配置\n\n在 `Hexo` 的 `_config.yml` 中调整\n\n## 基础配置\n\n```yml\n# 网页标题\ntitle: 17px blog\n# 侧边栏顶部显示\nsubtitle: \"Mozzie\"\n# 用于SEO的html元描述\ndescription: \"\"\n# 用于SEO的html关键字\nkeywords:\n# 文章版权声明显示作者名称\nauthor: Mozzie\n\n# 在此处设置您的网站url\nurl: https://mozzie.cn\n```\n\n## 语言\n\n你可以在 `hexo-theme-cosy/languages` 中找到不同的语言文件,如果想切换语言,在配置文件中,填入 `yml` 的文件名\n\n```yml\nlanguage: en\n```\n\n## 文章语法高亮\n\n关闭hexo默认的highlight.js语法高亮\n\n```yml\nhighlight:\n enable: false\n line_number: true\n auto_detect: false\n tab_replace: \"\"\n wrap: true\n hljs: false\n\nprismjs:\n enable: true\n preprocess: true\n line_number: true\n line_threshold: 0\n tab_replace: \"\"\n```\n\n# Cosy 主题配置\n\n下面的配置基于 `Hexo-theme-cosy` 下的 `_config.yml` \n\n## 文章分类图标\n\n按照顺序,依次设置 `svg` 图标,可以在 [xicon](https://www.xicons.org/) 方面的获取丰富的图标\n\n```yml\npostCategoryIcons:\n - \n - \n - \n```\n\n## 网站图标 favicon\n\n- 支持 `svg`\n- 支持 `图片url`,如:`/img/favicon.png`\n\n```yml\nfavicon: ''\n```\n\n## ICP备案号\n\n😁 如不需要备案号,可直接删除\n\n```yml\nicp: 苏ICP备xxxxxxx号-x\n```\n\n## 首页底部文字\n\n😁 如不需要,可直接删除,或者改为 `false` \n\n```yml\nmotto: false\n```\n\n## 文章版权申明\n\n默认开启,当 `enable: false`,默认关闭\n\n```yml\npostCopyright:\n enable: true\n license: CC BY-NC-SA 4.0\n license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/\n```\n\n## katex 数学公式\n\n可自行配置 `cdn`\n\n```yml\nkatex:\n enable: true\n jsCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.js\n cssCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.css\n```\n\n## mermaid 流程图\n\n在撰写时,请使用 `{% mermaid %}` 和 `{% endmermaid %}` 包裹\n\n```markdown\n{% mermaid %}\ngraph TD;\n A --> B;\n A --> C;\n B --> D;\n C --> D;\n{% endmermaid %}\n```\n\n相应配置如下\n\n```yml\nmermaid:\n enable: true\n cdn: //cdn.jsdelivr.net/npm/mermaid@10.4.0/dist/mermaid.min.js\n```\n\n## valine 文章评论\n\n首先需要注册 `LeanCloud` 国际区用户,创建数据库\n\n请根据相关地区法规,酌情\n\n```yml\nvaline:\n enable: true\n # 替换\n appId: appId\n # 替换\n appKey: appKey\n avatar: monsterid\n cdn: //unpkg.com/valine@latest/dist/Valine.min.js\n # 替换\n serverURLs: //xxxxxxxx.api.lncldglobal.com\n```\n\n# algolia搜索\n\n博客自带的本地搜索,基于前端开发,存在或多或少的问题,建议换成 `algolia`,免费账户 总共有 `10,000` 条记录,每月有 `100,000` 的操作数\n\n## 注册 & 获取 Key\n\n1. 创建一个新的 `Index`,例如 `hex-blog`\n\n2. 复制并保存:\n - Application ID\n - Search-Only API Key\n - Admin API Key\n - Usage API Key\n\n![API Keys](/img/algolia-api-keys.png)\n\n3. 替换配置\n\n在 `Hexo` 的 `_config.yml` 中加入\n\n```yml\nalgolia:\n # 替换\n appId: Application ID\n # 替换\n apiKey: Usage API Key\n # 请勿泄露,用于上报,替换\n adminApiKey: Admin API Key\n # 替换\n SearchOnlyAPIKey: Search-Only API Key\n chunkSize: 5000\n # 替换\n indexName: hex-blog\n fields:\n - content:strip\n - categories\n - date\n - permalink\n - slug\n - tags\n - title\n```\n\n## 安装 hexo-algoliasearch\n\n这是 Hexo 博客帖子索引插件,自动化提交索引到 Algolia\n\n> 如出遇到问题,可阅读 [hexo-algoliasearch 仓库](https://www.npmjs.com/package/hexo-algoliasearch) 最新说明\n\n安装命令:\n\n```bash\nnpm install hexo-algoliasearch --save\n```\n\n## 使用 algolia\n\n在每次博客发布之前,进行索引上传的操作,命令通常如下\n\n```bash\nhexo clean\nhexo generate\nhexo algolia\n``` \n\n\n# 🇨🇳 和风天气 Widget\n\nCosy 主要针对国内用户,在首页集成了和风天气的卡片,通过 [和风天气开发服务](https://dev.qweather.com/docs/start/) 注册\n\n注册完成后,在配置中填入你的 `appKey` 和 `cityCode(城市代码)`\n\n```yml\nweather:\n enable: true\n # 替换\n cityCode: cityCode\n appKey: appKey\n```\n\n其中 `cityCode` 可以在 [官方的地区列表仓库](https://github.com/qwd/LocationList) 中的 `China-City-List-latest.csv` 找到你所在城市的 `cityCode`\n\n# 前置元数据\n\n在 Hexo 的 Markdown 文件中,一个典型的 YAML 格式的 `Front Matter` 可能会是这样的:\n\n```markdown\n---\ntitle: 我的文章标题\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n## top\n\n实现文章置顶的功能,给定一个数值,可以进行排序,设定了 `top` 元数据的文章,会在分类列表中,使用 📌 标记\n\n例如有三篇文章:\n\n- 文章1\n\n```markdown\n---\ntitle: 文章1\ntop: 0\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n- 文章2\n\n```markdown\n---\ntitle: 文章2\ntop: 1\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n- 文章3\n\n```markdown\n---\ntitle: 文章3\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---\n```\n\n那么在 `javascript` 分类下,排序的顺序依次为:`文章1 > 文章2 > 文章3`\n\n## status\n\n用于区分文章的状态,同时利用文章分类列表的`筛选`,进行快速筛选,Cosy 主题内置了 4 种状态\n\n- done:完成\n- doing:进行中\n- todo:待办\n- other:废弃\n\n例如:\n\n```markdown\n---\ntitle: 文章1\ncategories:\n- javascript\nstatus: done\n---\n```\n\n# 自定义页面\n\nHexo 使用 Markdown(或其他渲染引擎)解析你的文章,并生成静态文件以快速加载。除了默认生成的文章和归档页面之外,Hexo 还允许你创建自定义页面。\n\n## Roadmap路线图\n\n创建页面,你可以使用命令\n\n```bash\nhexo new page roadmap\n```\n\n成功后在 `source/` 文件夹下会生成一个新的文件夹 `/roadmap/index.md`\n\n你可以参照此模板,进行配置,参数说明:\n\n- title: roadmap页面 html 的标题\n- initYear: 默认显示的年份\n\n```markdown\n---\ntitle: 陈不渡 - roadmap\nlayout: roadmap\ninitYear: 2023\nyears:\n 2022:\n - title: 读书\n start: 01-01\n end: 1-5\n - title: 还是读书\n start: 02-01\n end: 05-30\n 2023:\n - title: 越陌度阡\n start: 01-01\n end: 1-2\n - title: 枉用相存\n start: 02-01\n end: 06-30\n - title: 短歌行\n start: 10-26\n end: 10-31\n content: 对酒当歌,人生几何!譬如朝露,去日苦多。慨当以慷,忧思难忘。何以解忧?唯有杜康。青青子衿,悠悠我心。但为君故,沉吟至今。呦呦鹿鸣,食野之苹。\n - title: 声律启蒙\n start: 11-01\n end: 11-31\n content: 花开红锦绣,水漾碧琉璃。去妇因探邻舍枣,出妻为种后园葵\n---\n```\n\n## Resume简历页面\n\n创建页面,你可以使用命令\n\n```bash\nhexo new page resume\n```\n\n成功后在 `source/` 文件夹下会生成一个新的文件夹 `/resume/index.md`\n\n你可以参照此模板,进行配置,参数说明:\n\n- title: resume 页面 html 的标题\n- avatar: 头像图片的地址\n\n```yml\ntitle: 页面标题document.title\nlayout: resume\navatar: /img/avatar.png\nname: Hi! Mozzie\nrole: Full Stack\nemail: himozzie@gmail.com\nphone: +86 180-xxxx-xxx\nbirth: Jan 21, 1994\nlocation: Nanjing, China\nsocial:\n - name: github\n link: https://github.com/17px\n icon: svg\n\nabout:\n - 我的工作是建立你的网站,使其功能强大,用户友好,但同时具有吸引力。\n - 此外,我为您的产品添加了个人风格,并确保其引人注目且易于使用。我的目标是以最有创意的方式传达你的信息和身份。我为许多知名品牌公司设计网页。\n\nskill:\n - 熟悉Node,具备后端开发能力,有SpringBoot、Egg、Koa2、Midway等单个应用项目经验,有Nestjs微服务应用项目经验\n - 具有Monoreo工程经验,能够分离单个单元的前端和后端并应用DevOps\n\neducation:\n - school: 大学艺术学院\n time: 2012-2016\n\nworkExp:\n - inc: 创意研发\n time: 2021.09 ~ 至今\n - inc: Web设计\n time: 2021.01 ~ 2021.09\n\nprojectExp:\n - name: PC/React• 标注 ,算法数据中心\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n list: \n - 使用pnpm工作区管理Monorepo中的多个代码库,支持多个框架共存,共享通用组件库和功能\n\n - name: PC/React•Tavigator主动脉根部/外周\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n\n\nportfolio:\n - name: 项目A\n desc: 项目A描述\n iconSVG: 复制svg的path到这里\n link: 网址,http(s)://...\n # 更多 ...\n\n```","slug":"Cosy-Starter-Guide","published":1,"date":"2023-10-23T04:01:13.108Z","updated":"2023-11-03T06:24:27.385Z","comments":1,"layout":"post","photos":[],"link":"","_id":"cloi8dca10003edz3388g2klm","content":"Hexo
主题的安装方式非常简单,只需将主题 Hexo-theme-cosy
复制目录的 themes
目录下,然后在 Hexo
的 _config.yml
中修改下主题配置即可
# 找到 theme 配置项\ntheme: Hexo-theme-cosy
\n\nhexo-theme-cosy.zip
themes
目录下_config.yml
中启用在 Hexo
的 _config.yml
中调整
# 网页标题\ntitle: 17px blog\n# 侧边栏顶部显示\nsubtitle: \"Mozzie\"\n# 用于SEO的html元描述\ndescription: \"\"\n# 用于SEO的html关键字\nkeywords:\n# 文章版权声明显示作者名称\nauthor: Mozzie\n\n# 在此处设置您的网站url\nurl: https://mozzie.cn
\n\n你可以在 hexo-theme-cosy/languages
中找到不同的语言文件,如果想切换语言,在配置文件中,填入 yml
的文件名
language: en
\n\n关闭hexo默认的highlight.js语法高亮
\nhighlight:\n enable: false\n line_number: true\n auto_detect: false\n tab_replace: \"\"\n wrap: true\n hljs: false\n\nprismjs:\n enable: true\n preprocess: true\n line_number: true\n line_threshold: 0\n tab_replace: \"\"
\n\n下面的配置基于 Hexo-theme-cosy
下的 _config.yml
按照顺序,依次设置 svg
图标,可以在 xicon 方面的获取丰富的图标
postCategoryIcons:\n - <svg>...</svg>\n - <svg>...</svg>\n - <svg>...</svg>
\n\nsvg
图片url
,如:/img/favicon.png
favicon: ''
\n\n😁 如不需要备案号,可直接删除
\nicp: 苏ICP备xxxxxxx号-x
\n\n😁 如不需要,可直接删除,或者改为 false
motto: false
\n\n默认开启,当 enable: false
,默认关闭
postCopyright:\n enable: true\n license: CC BY-NC-SA 4.0\n license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
\n\n可自行配置 cdn
katex:\n enable: true\n jsCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.js\n cssCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.css
\n\n在撰写时,请使用 {% mermaid %}` 和 `{% endmermaid %}
包裹
{% mermaid %}\ngraph TD;\n A --> B;\n A --> C;\n B --> D;\n C --> D;\n{% endmermaid %}
\n\n相应配置如下
\nmermaid:\n enable: true\n cdn: //cdn.jsdelivr.net/npm/mermaid@10.4.0/dist/mermaid.min.js
\n\n首先需要注册 LeanCloud
国际区用户,创建数据库
请根据相关地区法规,酌情
\nvaline:\n enable: true\n # 替换\n appId: appId\n # 替换\n appKey: appKey\n avatar: monsterid\n cdn: //unpkg.com/valine@latest/dist/Valine.min.js\n # 替换\n serverURLs: //xxxxxxxx.api.lncldglobal.com
\n\n博客自带的本地搜索,基于前端开发,存在或多或少的问题,建议换成 algolia
,免费账户 总共有 10,000
条记录,每月有 100,000
的操作数
创建一个新的 Index
,例如 hex-blog
复制并保存:
\n在 Hexo
的 _config.yml
中加入
algolia:\n # 替换\n appId: Application ID\n # 替换\n apiKey: Usage API Key\n # 请勿泄露,用于上报,替换\n adminApiKey: Admin API Key\n # 替换\n SearchOnlyAPIKey: Search-Only API Key\n chunkSize: 5000\n # 替换\n indexName: hex-blog\n fields:\n - content:strip\n - categories\n - date\n - permalink\n - slug\n - tags\n - title
\n\n这是 Hexo 博客帖子索引插件,自动化提交索引到 Algolia
\n\n\n如出遇到问题,可阅读 hexo-algoliasearch 仓库 最新说明
\n
安装命令:
\nnpm install hexo-algoliasearch --save
\n\n在每次博客发布之前,进行索引上传的操作,命令通常如下
\nhexo clean\nhexo generate\nhexo algolia
\n\n\nCosy 主要针对国内用户,在首页集成了和风天气的卡片,通过 和风天气开发服务 注册
\n注册完成后,在配置中填入你的 appKey
和 cityCode(城市代码)
weather:\n enable: true\n # 替换\n cityCode: cityCode\n appKey: appKey
\n\n其中 cityCode
可以在 官方的地区列表仓库 中的 China-City-List-latest.csv
找到你所在城市的 cityCode
在 Hexo 的 Markdown 文件中,一个典型的 YAML 格式的 Front Matter
可能会是这样的:
---\ntitle: 我的文章标题\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n实现文章置顶的功能,给定一个数值,可以进行排序,设定了 top
元数据的文章,会在分类列表中,使用 📌 标记
例如有三篇文章:
\n---\ntitle: 文章1\ntop: 0\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n---\ntitle: 文章2\ntop: 1\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n---\ntitle: 文章3\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n那么在 javascript
分类下,排序的顺序依次为:文章1 > 文章2 > 文章3
用于区分文章的状态,同时利用文章分类列表的筛选
,进行快速筛选,Cosy 主题内置了 4 种状态
例如:
\n---\ntitle: 文章1\ncategories:\n- javascript\nstatus: done\n---
\n\nHexo 使用 Markdown(或其他渲染引擎)解析你的文章,并生成静态文件以快速加载。除了默认生成的文章和归档页面之外,Hexo 还允许你创建自定义页面。
\n创建页面,你可以使用命令
\nhexo new page roadmap
\n\n成功后在 source/
文件夹下会生成一个新的文件夹 /roadmap/index.md
你可以参照此模板,进行配置,参数说明:
\n---\ntitle: 陈不渡 - roadmap\nlayout: roadmap\ninitYear: 2023\nyears:\n 2022:\n - title: 读书\n start: 01-01\n end: 1-5\n - title: 还是读书\n start: 02-01\n end: 05-30\n 2023:\n - title: 越陌度阡\n start: 01-01\n end: 1-2\n - title: 枉用相存\n start: 02-01\n end: 06-30\n - title: 短歌行\n start: 10-26\n end: 10-31\n content: 对酒当歌,人生几何!譬如朝露,去日苦多。慨当以慷,忧思难忘。何以解忧?唯有杜康。青青子衿,悠悠我心。但为君故,沉吟至今。呦呦鹿鸣,食野之苹。\n - title: 声律启蒙\n start: 11-01\n end: 11-31\n content: 花开红锦绣,水漾碧琉璃。去妇因探邻舍枣,出妻为种后园葵\n---
\n\n创建页面,你可以使用命令
\nhexo new page resume
\n\n成功后在 source/
文件夹下会生成一个新的文件夹 /resume/index.md
你可以参照此模板,进行配置,参数说明:
\ntitle: 页面标题document.title\nlayout: resume\navatar: /img/avatar.png\nname: Hi! Mozzie\nrole: Full Stack\nemail: himozzie@gmail.com\nphone: +86 180-xxxx-xxx\nbirth: Jan 21, 1994\nlocation: Nanjing, China\nsocial:\n - name: github\n link: https://github.com/17px\n icon: svg\n\nabout:\n - 我的工作是建立你的网站,使其功能强大,用户友好,但同时具有吸引力。\n - 此外,我为您的产品添加了个人风格,并确保其引人注目且易于使用。我的目标是以最有创意的方式传达你的信息和身份。我为许多知名品牌公司设计网页。\n\nskill:\n - 熟悉Node,具备后端开发能力,有SpringBoot、Egg、Koa2、Midway等单个应用项目经验,有Nestjs微服务应用项目经验\n - 具有Monoreo工程经验,能够分离单个单元的前端和后端并应用DevOps\n\neducation:\n - school: 大学艺术学院\n time: 2012-2016\n\nworkExp:\n - inc: 创意研发\n time: 2021.09 ~ 至今\n - inc: Web设计\n time: 2021.01 ~ 2021.09\n\nprojectExp:\n - name: PC/React• 标注 ,算法数据中心\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n list: \n - 使用pnpm工作区管理Monorepo中的多个代码库,支持多个框架共存,共享通用组件库和功能\n\n - name: PC/React•Tavigator主动脉根部/外周\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n\n\nportfolio:\n - name: 项目A\n desc: 项目A描述\n iconSVG: 复制svg的path到这里\n link: 网址,http(s)://...\n # 更多 ...\n
","site":{"data":{}},"excerpt":"","more":"Hexo
主题的安装方式非常简单,只需将主题 Hexo-theme-cosy
复制目录的 themes
目录下,然后在 Hexo
的 _config.yml
中修改下主题配置即可
# 找到 theme 配置项\ntheme: Hexo-theme-cosy
\n\nhexo-theme-cosy.zip
themes
目录下_config.yml
中启用在 Hexo
的 _config.yml
中调整
# 网页标题\ntitle: 17px blog\n# 侧边栏顶部显示\nsubtitle: \"Mozzie\"\n# 用于SEO的html元描述\ndescription: \"\"\n# 用于SEO的html关键字\nkeywords:\n# 文章版权声明显示作者名称\nauthor: Mozzie\n\n# 在此处设置您的网站url\nurl: https://mozzie.cn
\n\n你可以在 hexo-theme-cosy/languages
中找到不同的语言文件,如果想切换语言,在配置文件中,填入 yml
的文件名
language: en
\n\n关闭hexo默认的highlight.js语法高亮
\nhighlight:\n enable: false\n line_number: true\n auto_detect: false\n tab_replace: \"\"\n wrap: true\n hljs: false\n\nprismjs:\n enable: true\n preprocess: true\n line_number: true\n line_threshold: 0\n tab_replace: \"\"
\n\n下面的配置基于 Hexo-theme-cosy
下的 _config.yml
按照顺序,依次设置 svg
图标,可以在 xicon 方面的获取丰富的图标
postCategoryIcons:\n - <svg>...</svg>\n - <svg>...</svg>\n - <svg>...</svg>
\n\nsvg
图片url
,如:/img/favicon.png
favicon: ''
\n\n😁 如不需要备案号,可直接删除
\nicp: 苏ICP备xxxxxxx号-x
\n\n😁 如不需要,可直接删除,或者改为 false
motto: false
\n\n默认开启,当 enable: false
,默认关闭
postCopyright:\n enable: true\n license: CC BY-NC-SA 4.0\n license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
\n\n可自行配置 cdn
katex:\n enable: true\n jsCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.js\n cssCdn: //cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.css
\n\n在撰写时,请使用 {% mermaid %}` 和 `{% endmermaid %}
包裹
{% mermaid %}\ngraph TD;\n A --> B;\n A --> C;\n B --> D;\n C --> D;\n{% endmermaid %}
\n\n相应配置如下
\nmermaid:\n enable: true\n cdn: //cdn.jsdelivr.net/npm/mermaid@10.4.0/dist/mermaid.min.js
\n\n首先需要注册 LeanCloud
国际区用户,创建数据库
请根据相关地区法规,酌情
\nvaline:\n enable: true\n # 替换\n appId: appId\n # 替换\n appKey: appKey\n avatar: monsterid\n cdn: //unpkg.com/valine@latest/dist/Valine.min.js\n # 替换\n serverURLs: //xxxxxxxx.api.lncldglobal.com
\n\n博客自带的本地搜索,基于前端开发,存在或多或少的问题,建议换成 algolia
,免费账户 总共有 10,000
条记录,每月有 100,000
的操作数
创建一个新的 Index
,例如 hex-blog
复制并保存:
\n在 Hexo
的 _config.yml
中加入
algolia:\n # 替换\n appId: Application ID\n # 替换\n apiKey: Usage API Key\n # 请勿泄露,用于上报,替换\n adminApiKey: Admin API Key\n # 替换\n SearchOnlyAPIKey: Search-Only API Key\n chunkSize: 5000\n # 替换\n indexName: hex-blog\n fields:\n - content:strip\n - categories\n - date\n - permalink\n - slug\n - tags\n - title
\n\n这是 Hexo 博客帖子索引插件,自动化提交索引到 Algolia
\n\n\n如出遇到问题,可阅读 hexo-algoliasearch 仓库 最新说明
\n
安装命令:
\nnpm install hexo-algoliasearch --save
\n\n在每次博客发布之前,进行索引上传的操作,命令通常如下
\nhexo clean\nhexo generate\nhexo algolia
\n\n\nCosy 主要针对国内用户,在首页集成了和风天气的卡片,通过 和风天气开发服务 注册
\n注册完成后,在配置中填入你的 appKey
和 cityCode(城市代码)
weather:\n enable: true\n # 替换\n cityCode: cityCode\n appKey: appKey
\n\n其中 cityCode
可以在 官方的地区列表仓库 中的 China-City-List-latest.csv
找到你所在城市的 cityCode
在 Hexo 的 Markdown 文件中,一个典型的 YAML 格式的 Front Matter
可能会是这样的:
---\ntitle: 我的文章标题\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n实现文章置顶的功能,给定一个数值,可以进行排序,设定了 top
元数据的文章,会在分类列表中,使用 📌 标记
例如有三篇文章:
\n---\ntitle: 文章1\ntop: 0\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n---\ntitle: 文章2\ntop: 1\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n---\ntitle: 文章3\ncategories:\n- javascript\ntags: \n- 编程\n- JavaScript\n---
\n\n那么在 javascript
分类下,排序的顺序依次为:文章1 > 文章2 > 文章3
用于区分文章的状态,同时利用文章分类列表的筛选
,进行快速筛选,Cosy 主题内置了 4 种状态
例如:
\n---\ntitle: 文章1\ncategories:\n- javascript\nstatus: done\n---
\n\nHexo 使用 Markdown(或其他渲染引擎)解析你的文章,并生成静态文件以快速加载。除了默认生成的文章和归档页面之外,Hexo 还允许你创建自定义页面。
\n创建页面,你可以使用命令
\nhexo new page roadmap
\n\n成功后在 source/
文件夹下会生成一个新的文件夹 /roadmap/index.md
你可以参照此模板,进行配置,参数说明:
\n---\ntitle: 陈不渡 - roadmap\nlayout: roadmap\ninitYear: 2023\nyears:\n 2022:\n - title: 读书\n start: 01-01\n end: 1-5\n - title: 还是读书\n start: 02-01\n end: 05-30\n 2023:\n - title: 越陌度阡\n start: 01-01\n end: 1-2\n - title: 枉用相存\n start: 02-01\n end: 06-30\n - title: 短歌行\n start: 10-26\n end: 10-31\n content: 对酒当歌,人生几何!譬如朝露,去日苦多。慨当以慷,忧思难忘。何以解忧?唯有杜康。青青子衿,悠悠我心。但为君故,沉吟至今。呦呦鹿鸣,食野之苹。\n - title: 声律启蒙\n start: 11-01\n end: 11-31\n content: 花开红锦绣,水漾碧琉璃。去妇因探邻舍枣,出妻为种后园葵\n---
\n\n创建页面,你可以使用命令
\nhexo new page resume
\n\n成功后在 source/
文件夹下会生成一个新的文件夹 /resume/index.md
你可以参照此模板,进行配置,参数说明:
\ntitle: 页面标题document.title\nlayout: resume\navatar: /img/avatar.png\nname: Hi! Mozzie\nrole: Full Stack\nemail: himozzie@gmail.com\nphone: +86 180-xxxx-xxx\nbirth: Jan 21, 1994\nlocation: Nanjing, China\nsocial:\n - name: github\n link: https://github.com/17px\n icon: svg\n\nabout:\n - 我的工作是建立你的网站,使其功能强大,用户友好,但同时具有吸引力。\n - 此外,我为您的产品添加了个人风格,并确保其引人注目且易于使用。我的目标是以最有创意的方式传达你的信息和身份。我为许多知名品牌公司设计网页。\n\nskill:\n - 熟悉Node,具备后端开发能力,有SpringBoot、Egg、Koa2、Midway等单个应用项目经验,有Nestjs微服务应用项目经验\n - 具有Monoreo工程经验,能够分离单个单元的前端和后端并应用DevOps\n\neducation:\n - school: 大学艺术学院\n time: 2012-2016\n\nworkExp:\n - inc: 创意研发\n time: 2021.09 ~ 至今\n - inc: Web设计\n time: 2021.01 ~ 2021.09\n\nprojectExp:\n - name: PC/React• 标注 ,算法数据中心\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n list: \n - 使用pnpm工作区管理Monorepo中的多个代码库,支持多个框架共存,共享通用组件库和功能\n\n - name: PC/React•Tavigator主动脉根部/外周\n desc: 这是一个xxx系统。它主要包括一个bc函数。我主要负责x、y和z模块的开发和维护。\n\n\nportfolio:\n - name: 项目A\n desc: 项目A描述\n iconSVG: 复制svg的path到这里\n link: 网址,http(s)://...\n # 更多 ...\n
"},{"title":"有效对话指南","top":0,"status":"done","_content":"\n卡耐基说过:要说服别人同意你的观点,你就要让他觉得这是他自己的观点。也就是说,本质上没有人真正被别人说服,听或者不听都是他们自己的主动选择\n\n# 目的\n\n沟通目的无非两个:\n\n- 让对方认同我们的观点\n- 或者按我们说的做\n\n# 搞定情绪\n\n大多数人的立场和行为,是由情绪决定的,对方不喜欢你,你再怎么努力也很难说服他,只有他认可你这个人你的话他才会听。所以动之以理之前要先小之以轻,你把他情绪搞定了,沟通也就成功了一半\n\n## 夸 - 细节\n\n不吝赞美,就一个字“夸”,具体怎么夸呢?\n\n细节就是不要太笼统:\n\n- 😭 你穿的真好看 \n- 😊 今天的上衣显得你很白,太美了\n\n## 夸 - 对比\n\n- 😭 你今天穿的真好看\n- 😊 你今天穿的真好看,一般人可传不出这种气质\n\n## 我能理解你,换我也生气\n\n接纳对方的负面情绪,把双方情绪拉回到安全范围内。\n\n## 肢体同步\n\n如果你的肢体动作跟对方同步,它会产生一种被共情的感觉\n\n- 对方说的火热,身体前倾,伺机凑近\n- 思考一到两秒钟再反馈,这个简单的停顿\n\n# 只陈述不评论\n\n事实不会引起争议\n\n比如:孩子考试没及格是事实,说他笨死了就是评论了。\n\n再比如:你这周上班迟到两次,这是事实,说你经常迟到就是评论了。\n\n## 评论副词\n\n尽量规避一些跟评论相关的糊的频率副词,比如\n- 笨\n- 懒\n- 坏\n- 总是\n- 永远\n- 每次\n\n# 保持开放性\n\n还拿上面的例子,这些话对方只能回答好或者不好,然后结束沟通\n\n- 孩子没及格,老爸说下次必须及格。\n- 你上班迟到,老板说再迟到扣薪水。\n\n如果换成开放式沟通:\n\n- 老爸说咱们聊聊哪些题没有搞清楚\n- 老板说生活上是不是遇到了什么问题,没着我可以帮你\n\n# 反馈事实\n\n这些话对方不仅听着舒服,而且能给你反馈事实。具体怎么开放呢?咱们只需要记住两个关键词\n\n- 问题开放:不要让对方只能回答是或否,例如:像愿闻其详、展开说说、欢迎补充之类\n- 让出话语权:真正的沟通高手,是让对方觉得自己很牛,主导聊天的往往是能提出问题的人,或者让别人多说的人\n\n","source":"_posts/A Guide to Effective Dialogue.md","raw":"---\ntitle: 有效对话指南\ntop: 0\ncategories:\n - EQ\nstatus: done\n---\n\n卡耐基说过:要说服别人同意你的观点,你就要让他觉得这是他自己的观点。也就是说,本质上没有人真正被别人说服,听或者不听都是他们自己的主动选择\n\n# 目的\n\n沟通目的无非两个:\n\n- 让对方认同我们的观点\n- 或者按我们说的做\n\n# 搞定情绪\n\n大多数人的立场和行为,是由情绪决定的,对方不喜欢你,你再怎么努力也很难说服他,只有他认可你这个人你的话他才会听。所以动之以理之前要先小之以轻,你把他情绪搞定了,沟通也就成功了一半\n\n## 夸 - 细节\n\n不吝赞美,就一个字“夸”,具体怎么夸呢?\n\n细节就是不要太笼统:\n\n- 😭 你穿的真好看 \n- 😊 今天的上衣显得你很白,太美了\n\n## 夸 - 对比\n\n- 😭 你今天穿的真好看\n- 😊 你今天穿的真好看,一般人可传不出这种气质\n\n## 我能理解你,换我也生气\n\n接纳对方的负面情绪,把双方情绪拉回到安全范围内。\n\n## 肢体同步\n\n如果你的肢体动作跟对方同步,它会产生一种被共情的感觉\n\n- 对方说的火热,身体前倾,伺机凑近\n- 思考一到两秒钟再反馈,这个简单的停顿\n\n# 只陈述不评论\n\n事实不会引起争议\n\n比如:孩子考试没及格是事实,说他笨死了就是评论了。\n\n再比如:你这周上班迟到两次,这是事实,说你经常迟到就是评论了。\n\n## 评论副词\n\n尽量规避一些跟评论相关的糊的频率副词,比如\n- 笨\n- 懒\n- 坏\n- 总是\n- 永远\n- 每次\n\n# 保持开放性\n\n还拿上面的例子,这些话对方只能回答好或者不好,然后结束沟通\n\n- 孩子没及格,老爸说下次必须及格。\n- 你上班迟到,老板说再迟到扣薪水。\n\n如果换成开放式沟通:\n\n- 老爸说咱们聊聊哪些题没有搞清楚\n- 老板说生活上是不是遇到了什么问题,没着我可以帮你\n\n# 反馈事实\n\n这些话对方不仅听着舒服,而且能给你反馈事实。具体怎么开放呢?咱们只需要记住两个关键词\n\n- 问题开放:不要让对方只能回答是或否,例如:像愿闻其详、展开说说、欢迎补充之类\n- 让出话语权:真正的沟通高手,是让对方觉得自己很牛,主导聊天的往往是能提出问题的人,或者让别人多说的人\n\n","slug":"A Guide to Effective Dialogue","published":1,"date":"2023-10-24T01:47:38.891Z","updated":"2023-10-24T01:47:38.891Z","comments":1,"layout":"post","photos":[],"link":"","_id":"cloi8dca30005edz3bhh0bz4o","content":"卡耐基说过:要说服别人同意你的观点,你就要让他觉得这是他自己的观点。也就是说,本质上没有人真正被别人说服,听或者不听都是他们自己的主动选择
\n沟通目的无非两个:
\n大多数人的立场和行为,是由情绪决定的,对方不喜欢你,你再怎么努力也很难说服他,只有他认可你这个人你的话他才会听。所以动之以理之前要先小之以轻,你把他情绪搞定了,沟通也就成功了一半
\n不吝赞美,就一个字“夸”,具体怎么夸呢?
\n细节就是不要太笼统:
\n接纳对方的负面情绪,把双方情绪拉回到安全范围内。
\n如果你的肢体动作跟对方同步,它会产生一种被共情的感觉
\n事实不会引起争议
\n比如:孩子考试没及格是事实,说他笨死了就是评论了。
\n再比如:你这周上班迟到两次,这是事实,说你经常迟到就是评论了。
\n尽量规避一些跟评论相关的糊的频率副词,比如
\n还拿上面的例子,这些话对方只能回答好或者不好,然后结束沟通
\n如果换成开放式沟通:
\n这些话对方不仅听着舒服,而且能给你反馈事实。具体怎么开放呢?咱们只需要记住两个关键词
\n卡耐基说过:要说服别人同意你的观点,你就要让他觉得这是他自己的观点。也就是说,本质上没有人真正被别人说服,听或者不听都是他们自己的主动选择
\n沟通目的无非两个:
\n大多数人的立场和行为,是由情绪决定的,对方不喜欢你,你再怎么努力也很难说服他,只有他认可你这个人你的话他才会听。所以动之以理之前要先小之以轻,你把他情绪搞定了,沟通也就成功了一半
\n不吝赞美,就一个字“夸”,具体怎么夸呢?
\n细节就是不要太笼统:
\n接纳对方的负面情绪,把双方情绪拉回到安全范围内。
\n如果你的肢体动作跟对方同步,它会产生一种被共情的感觉
\n事实不会引起争议
\n比如:孩子考试没及格是事实,说他笨死了就是评论了。
\n再比如:你这周上班迟到两次,这是事实,说你经常迟到就是评论了。
\n尽量规避一些跟评论相关的糊的频率副词,比如
\n还拿上面的例子,这些话对方只能回答好或者不好,然后结束沟通
\n如果换成开放式沟通:
\n这些话对方不仅听着舒服,而且能给你反馈事实。具体怎么开放呢?咱们只需要记住两个关键词
\n创建 & 配置config.yaml
文件
# Read about the best practices\n# https://verdaccio.org/docs/best\n\n# path to a directory with all packages\nstorage: /verdaccio/storage/data\n# path to a directory with plugins to include\nplugins: /verdaccio/plugins\n\n# 包体积上限,默认10mb\nmax_body_size: 1024mb\n\n\nweb:\n enable: true\n title: Mozzie-NPM\n # gravatar: false\n # login: true\n pkgManagers:\n - npm\n - yarn\n - pnpm\n html_cache: true\n showFooter: false\n\nauth:\n htpasswd:\n file: /verdaccio/storage/htpasswd\n # 关闭注册,手动添加用户,默认Bcrypt算法,随便找个网页生成个密码,使用账号:密码添加到 htpasswd 文件中,例如 test:$2a$10$0xPGVnpcdxcfmFxtWyWDx./TRtm/W/gSzib/jck3w.sF9x.Ur8t8W\n max_users: -1\n\n\ni18n:\n web: zh-CN\n\n# notify: # 配置 Webhook 推送到钉钉,记得修改 access_token 和 atMobiles\n# method: POST\n# headers: [{ \"Content-Type\": \"application/json\" }]\n# endpoint: https://oapi.dingtalk.com/robot/send?access_token=xxxx\n# content: '{\"msgtype\":\"text\", \"at\": {\"atMobiles\": [\"13000000000\"] }, \"text\":{\"content\":\"NPM 发布新包:\\n > 包名称:{{name}} \\n > 版本号:{{#each versions}}{{version}}{{/each}} \\n > 发布者:{{publisher.name}} \"}}'\n\nuplinks:\n npmjs:\n url: https://registry.npmjs.org/\n yarn:\n url: https://registry.yarnpkg.com/\n timeout: 10s\n taobao:\n url: https://registry.npmmirror.com/\n timeout: 10s\n\npackages:\n \"@*/*\":\n # 可访问权限,web界面看不见,不登陆,也无法 install 包\n access: $authenticated # $all\n # 发布权限, $authenticated 表示只有通过验证的人\n publish: $authenticated\n # 可取消发布权限\n unpublish: $authenticated\n # 包不存在时的代理\n proxy: npmjs yarn taobao\n \"**\":\n access: $authenticated # $all\n publish: $authenticated\n unpublish: $authenticated\n proxy: npmjs yarn taobao\n\nmiddlewares:\n audit:\n enabled: true\nlisten: 0.0.0.0:4873\nlog: { type: stdout, format: pretty, level: http }
\n\n创建容器,环境变量,VERDACCIO_PUBLIC_URL
是静态资源的前缀地址,由于nginx挂了ssl
,如果使用http
可以不添加
docker run \\\n-p 4873:4873 \\\n--restart=always \\\n--network mozzie.cn-net \\\n--network-alias verdaccio \\\n--env VERDACCIO_PORT=4873 \\\n--env VERDACCIO_PUBLIC_URL=https://npm.mozzie.cn \\\n--ip 172.21.0.196 \\\n--name verdaccio \\\n-v /www/wwwroot/nginx/html/verdaccio/storage:/verdaccio/storage \\\n-v /www/wwwroot/nginx/html/verdaccio/config:/verdaccio/conf \\\n-v /www/wwwroot/nginx/html/verdaccio/plugins:/verdaccio/plugins \\\n-d verdaccio/verdaccio
\n\n\n\n配置nginx的反向代理conf,注意所在的docker网络,使用container_name
server {\n # listen 80;\n listen 443 ssl;\n server_name npm.mozzie.cn;\n ssl_certificate /etc/nginx/ssl/npm.mozzie.cn_bundle.pem;\n ssl_certificate_key /etc/nginx/ssl/npm.mozzie.cn.key;\n gzip on;\n\n location / {\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header Host $host;\n proxy_set_header X-NginX-Proxy true;\n proxy_pass http://verdaccio:4873/;\n proxy_redirect off;\n }\n}
\n\n运行添加用户,报错,因为 htpasswd
默认创建在宿主机,也就是上面挂载的/www/wwwroot/nginx/html/verdaccio/storage
目录中
npm adduser --registry https://npm.mozzie.cn/
\n\n配置htpasswd
、storage
文件夹权限
# 宿主机中执行\ncd /www/wwwroot/nginx/html/verdaccio/storage\ntouch htpasswd\nsudo chown 10001:65533 htpasswd\nsudo chown -R 10001:65533 /www/wwwroot/nginx/html/verdaccio/storage
\n\n由于在 config.yml
中关闭了可访问权限
auth:\n htpasswd:\n file: /verdaccio/storage/htpasswd\n # 关闭注册,手动添加用户,默认Bcrypt算法,\n max_users: -1\n\npackages:\n \"@*/*\":\n # 可访问权限,web界面看不见,不登陆,也无法 install 包\n access: $authenticated # $all\n # 发布权限, $authenticated 表示只有通过验证的人\n publish: $authenticated\n # 可取消发布权限\n unpublish: $authenticated\n \"**\":\n access: $authenticated\n publish: $authenticated\n unpublish: $authenticated
\n\n默认的 addUser
策略是 Bcrypt
生成密码,随便找个网页生成个密码,使用账号:密码
添加到 htpasswd
文件中,例如
test:$2a$10$0xPGVnpcdxcfmFxtWyWDx./TRtm/W/gSzib/jck3w.sF9x.Ur8t8W
\n\n因此在实际开发中,管理员手动给用户创建好账号,然后根据用户的包管理工具,进行登录,例如以 npm
为例
npm adduser --registry https://npm.mozzie.cn/\n# 输入 Username: mozzie | Password: xxx | Email: (this IS public) himozzie@foxmail.com\n# 提示登陆成功 Logged in as mozzie on https://npm.mozzie.cn/.
\n\n在系统的 cat ~/.npmrc
中会增加一行,就可以正常的进行以来的安装了
//npm.mozzie.cn/:_authToken=\"Do/wrh5QzsnYaNU4x3ZlVA==\"
\n\n需要指定 .npmrc
来区别 Scope
的安装地址,例如一个包名为 @mozzie/hook
,对应的私库为 https://npm.mozzie.cn/
registry=http://registry.npm.taobao.org/\n@mozzie:registry=https://npm.mozzie.cn\n# npm拉包的校验\n//https://npm.mozzie.cn/:_authToken=xxxxxxxxxxxxx
","site":{"data":{}},"excerpt":"","more":"创建 & 配置config.yaml
文件
# Read about the best practices\n# https://verdaccio.org/docs/best\n\n# path to a directory with all packages\nstorage: /verdaccio/storage/data\n# path to a directory with plugins to include\nplugins: /verdaccio/plugins\n\n# 包体积上限,默认10mb\nmax_body_size: 1024mb\n\n\nweb:\n enable: true\n title: Mozzie-NPM\n # gravatar: false\n # login: true\n pkgManagers:\n - npm\n - yarn\n - pnpm\n html_cache: true\n showFooter: false\n\nauth:\n htpasswd:\n file: /verdaccio/storage/htpasswd\n # 关闭注册,手动添加用户,默认Bcrypt算法,随便找个网页生成个密码,使用账号:密码添加到 htpasswd 文件中,例如 test:$2a$10$0xPGVnpcdxcfmFxtWyWDx./TRtm/W/gSzib/jck3w.sF9x.Ur8t8W\n max_users: -1\n\n\ni18n:\n web: zh-CN\n\n# notify: # 配置 Webhook 推送到钉钉,记得修改 access_token 和 atMobiles\n# method: POST\n# headers: [{ \"Content-Type\": \"application/json\" }]\n# endpoint: https://oapi.dingtalk.com/robot/send?access_token=xxxx\n# content: '{\"msgtype\":\"text\", \"at\": {\"atMobiles\": [\"13000000000\"] }, \"text\":{\"content\":\"NPM 发布新包:\\n > 包名称:{{name}} \\n > 版本号:{{#each versions}}{{version}}{{/each}} \\n > 发布者:{{publisher.name}} \"}}'\n\nuplinks:\n npmjs:\n url: https://registry.npmjs.org/\n yarn:\n url: https://registry.yarnpkg.com/\n timeout: 10s\n taobao:\n url: https://registry.npmmirror.com/\n timeout: 10s\n\npackages:\n \"@*/*\":\n # 可访问权限,web界面看不见,不登陆,也无法 install 包\n access: $authenticated # $all\n # 发布权限, $authenticated 表示只有通过验证的人\n publish: $authenticated\n # 可取消发布权限\n unpublish: $authenticated\n # 包不存在时的代理\n proxy: npmjs yarn taobao\n \"**\":\n access: $authenticated # $all\n publish: $authenticated\n unpublish: $authenticated\n proxy: npmjs yarn taobao\n\nmiddlewares:\n audit:\n enabled: true\nlisten: 0.0.0.0:4873\nlog: { type: stdout, format: pretty, level: http }
\n\n创建容器,环境变量,VERDACCIO_PUBLIC_URL
是静态资源的前缀地址,由于nginx挂了ssl
,如果使用http
可以不添加
docker run \\\n-p 4873:4873 \\\n--restart=always \\\n--network mozzie.cn-net \\\n--network-alias verdaccio \\\n--env VERDACCIO_PORT=4873 \\\n--env VERDACCIO_PUBLIC_URL=https://npm.mozzie.cn \\\n--ip 172.21.0.196 \\\n--name verdaccio \\\n-v /www/wwwroot/nginx/html/verdaccio/storage:/verdaccio/storage \\\n-v /www/wwwroot/nginx/html/verdaccio/config:/verdaccio/conf \\\n-v /www/wwwroot/nginx/html/verdaccio/plugins:/verdaccio/plugins \\\n-d verdaccio/verdaccio
\n\n\n\n配置nginx的反向代理conf,注意所在的docker网络,使用container_name
server {\n # listen 80;\n listen 443 ssl;\n server_name npm.mozzie.cn;\n ssl_certificate /etc/nginx/ssl/npm.mozzie.cn_bundle.pem;\n ssl_certificate_key /etc/nginx/ssl/npm.mozzie.cn.key;\n gzip on;\n\n location / {\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header Host $host;\n proxy_set_header X-NginX-Proxy true;\n proxy_pass http://verdaccio:4873/;\n proxy_redirect off;\n }\n}
\n\n运行添加用户,报错,因为 htpasswd
默认创建在宿主机,也就是上面挂载的/www/wwwroot/nginx/html/verdaccio/storage
目录中
npm adduser --registry https://npm.mozzie.cn/
\n\n配置htpasswd
、storage
文件夹权限
# 宿主机中执行\ncd /www/wwwroot/nginx/html/verdaccio/storage\ntouch htpasswd\nsudo chown 10001:65533 htpasswd\nsudo chown -R 10001:65533 /www/wwwroot/nginx/html/verdaccio/storage
\n\n由于在 config.yml
中关闭了可访问权限
auth:\n htpasswd:\n file: /verdaccio/storage/htpasswd\n # 关闭注册,手动添加用户,默认Bcrypt算法,\n max_users: -1\n\npackages:\n \"@*/*\":\n # 可访问权限,web界面看不见,不登陆,也无法 install 包\n access: $authenticated # $all\n # 发布权限, $authenticated 表示只有通过验证的人\n publish: $authenticated\n # 可取消发布权限\n unpublish: $authenticated\n \"**\":\n access: $authenticated\n publish: $authenticated\n unpublish: $authenticated
\n\n默认的 addUser
策略是 Bcrypt
生成密码,随便找个网页生成个密码,使用账号:密码
添加到 htpasswd
文件中,例如
test:$2a$10$0xPGVnpcdxcfmFxtWyWDx./TRtm/W/gSzib/jck3w.sF9x.Ur8t8W
\n\n因此在实际开发中,管理员手动给用户创建好账号,然后根据用户的包管理工具,进行登录,例如以 npm
为例
npm adduser --registry https://npm.mozzie.cn/\n# 输入 Username: mozzie | Password: xxx | Email: (this IS public) himozzie@foxmail.com\n# 提示登陆成功 Logged in as mozzie on https://npm.mozzie.cn/.
\n\n在系统的 cat ~/.npmrc
中会增加一行,就可以正常的进行以来的安装了
//npm.mozzie.cn/:_authToken=\"Do/wrh5QzsnYaNU4x3ZlVA==\"
\n\n需要指定 .npmrc
来区别 Scope
的安装地址,例如一个包名为 @mozzie/hook
,对应的私库为 https://npm.mozzie.cn/
registry=http://registry.npm.taobao.org/\n@mozzie:registry=https://npm.mozzie.cn\n# npm拉包的校验\n//https://npm.mozzie.cn/:_authToken=xxxxxxxxxxxxx
"}],"PostAsset":[],"PostCategory":[{"post_id":"cloi8dca00002edz398bnea4t","category_id":"cloi8dca20004edz3916tgvzf","_id":"cloi8dca40009edz366wab4en"},{"post_id":"cloi8dca10003edz3388g2klm","category_id":"cloi8dca20004edz3916tgvzf","_id":"cloi8dca5000aedz3efib4t3k"},{"post_id":"cloi8dca30005edz3bhh0bz4o","category_id":"cloi8dca40008edz3ew1ta0kw","_id":"cloi8dca5000cedz38nrg802i"},{"post_id":"cloi8dca30006edz3e7la1txq","category_id":"cloi8dca5000bedz31vcheht4","_id":"cloi8dca5000dedz31vi13i0q"}],"PostTag":[],"Tag":[]}}