{"id":18256606,"url":"https://github.com/honmaple/snow","last_synced_at":"2026-05-09T09:32:51.523Z","repository":{"id":145149705,"uuid":"206943777","full_name":"honmaple/snow","owner":"honmaple","description":"static site generator","archived":false,"fork":false,"pushed_at":"2024-03-27T11:20:50.000Z","size":436,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-16T01:50:26.556Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/honmaple.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-09-07T09:09:55.000Z","updated_at":"2023-10-03T01:03:02.000Z","dependencies_parsed_at":"2024-03-27T10:54:27.270Z","dependency_job_id":"00d87d58-d723-44cf-924b-db72f4a72bf6","html_url":"https://github.com/honmaple/snow","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honmaple%2Fsnow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honmaple%2Fsnow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honmaple%2Fsnow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/honmaple%2Fsnow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/honmaple","download_url":"https://codeload.github.com/honmaple/snow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223151781,"owners_count":17096175,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T10:22:47.529Z","updated_at":"2026-05-09T09:32:51.513Z","avatar_url":"https://github.com/honmaple.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"* Snow\n  静态博客生成器\n\n** 快速开始\n*** 开始(Quickstart)\n**** 创建新的站点\n     #+begin_example\n     ──╼ ./snow init\n     Welcome to snow 0.1.0.\n     \u003e Where do you want to create your new web site? [.] mysnow\n     \u003e What will be the title of this web site? [snow]\n     \u003e Who will be the author of this web site?\n     The input is required\n     \u003e Who will be the author of this web site? honmaple\n     \u003e What is your URL prefix? (no trailing slash) [http://127.0.0.1:8000]\n     \u003e Do you want to create first page? [Y/n]\n     #+end_example\n\n**** 编译和预览\n     #+begin_example\n     └──╼ cd mysnow\n     └──╼ ../snow server -D\n     DEBU Copying @theme/static/css/main.css to output/static/css/main.css\n     INFO Done: Static Processed 1 static files in 588.705µs\n     DEBU Writing output/categories/index.html\n     DEBU Writing output/authors/index.html\n     DEBU Writing output/tags/index.html\n     DEBU Writing output/posts/index.html\n     DEBU Writing output/authors/snow/index.html\n     DEBU Writing output/tags/snow/index.html\n     DEBU Writing output/categories/linux/index.html\n     DEBU Writing output/tags/linux/index.html\n     DEBU Writing output/tags/emacs/index.html\n     DEBU Writing output/categories/linux/emacs/index.html\n     INFO Done: Page Processed 1 normal pages, 0 hidden pages, 0 section pages in 10.087804ms\n     INFO Done: Section Processed 1 posts in 10.1831ms\n     INFO Done: Taxonomy Processed 1 authors, 3 tags, 1 categories in 10.18788ms\n     #+end_example\n\n*** 安装(Installation)\n    #+begin_example\n    └──╼ go install https://github.com/honmaple/snow\n    #+end_example\n\n*** 编译(Build)\n    #+begin_example\n    └──╼ git clone https://github.com/honmaple/snow --depth=1\n    └──╼ cd snow\n    └──╼ go mod tidy\n    └──╼ go build .\n    #+end_example\n\n*** 命令行(Cli usage)\n    #+begin_example\n      └──╼ ./snow --help\n      NAME:\n         snow - snow is a static site generator.\n\n      USAGE:\n         snow [global options] command [command options] [arguments...]\n\n      VERSION:\n         0.1.0\n\n      COMMANDS:\n         init     init a new site\n         build    build and output\n         server   server local files\n         help, h  Shows a list of commands or help for one command\n\n      GLOBAL OPTIONS:\n         --config FILE, -c FILE  load configuration from FILE (default: \"config.yaml\")\n         --help, -h            show help (default: false)\n         --version, -v         print the version (default: false)\n    #+end_example\n**** init\n     #+begin_example\n      └──╼ ./snow init\n      └──╼ ./snow init myblog\n     #+end_example\n     如果不指定 *myblog* 目录，默认会在当前目录下生成一个 *config.yaml* 文件和一个 *content* 目录\n**** build\n     该命令会构建站点内容内写入到 *{output_dir}* 目录, 如果该目录已经有文件存在，除非制定 =-C= 参数，否则不会自动清理\n     - 清理输出目录\n       #+begin_example\n       └──╼ ./snow build --clean\n       └──╼ ./snow build -C\n       #+end_example\n     - 显示输出详情\n       #+begin_example\n       └──╼ ./snow build --debug\n       └──╼ ./snow build -D\n       #+end_example\n     - 指定输出目录\n       #+begin_example\n       └──╼ ./snow build --output {output_dir}\n       └──╼ ./snow build -o {output_dir}\n       #+end_example\n     - 指定mode\n       #+begin_example\n       └──╼ ./snow build --mode {mode}\n       └──╼ ./snow build -m {mode}\n       #+end_example\n**** server\n     build 支持的命令 server也同样支持, 除此之外，还有\n     - 指定监听地址\n       #+begin_example\n       └──╼ ./snow server --listen 127.0.0.1:8088\n       └──╼ ./snow server -l 127.0.0.1:8088\n       #+end_example\n       默认监听地址是 =site.url=\n     - 监听文件修改并重新构建\n       #+begin_example\n       └──╼ ./snow server --autoload\n       └──╼ ./snow server -r\n       #+end_example\n**** hooks\n     显示所有hooks\n     #+begin_example\n     └──╼ ./snow hooks\n     assets(enabled), encrypt(enabled), filter, minify, pelican(enabled), rewrite(enabled), shortcode(enabled)\n     #+end_example\n\n*** 目录结构(Driectory structure)\n    #+begin_example\n    .\n    ├── config.yaml\n    ├── content\n    │   └── posts\n    │       └── first-page.md\n    ├── static\n    ├── templates\n    └── themes\n    │   └── snow\n    │       └── static\n    │       └── templates\n    #+end_example\n    - *config.yaml*: 配置文件\n    - *content*: 内容目录\n    - *static*: 静态文件目录，该目录下的所有文件都会同步到站点的根目录\n    - *templates*: 模版目录\n    - *themes*: 主题目录\n*** 配置文件(Configuration)\n    #+begin_src yaml\n    # 站点配置信息\n    base_url: \"http://127.0.0.1:8000\"\n    title: \"Snow\"\n    description: \"snow is a static site generator.\"\n    author: \"honmaple\"\n    language: \"zh\"\n\n    # 发布时使用的配置\n    modes.publish:\n      base_url: \"https://honmaple.me\"\n\n    # 多语言en使用的配置\n    languages.en:\n      base_url: \"https://honmaple.me/en\"\n\n    output_dir: \"output\"\n    content_dir: \"content\"\n\n    theme: \"snow\"\n\n    # 按照主题需要进行配置\n    params.extra:\n      menus:\n        - name: \"关于\"\n          url: \"/pages/about.html\"\n    #+end_src\n** 内容管理\n   #+begin_src yaml\n   # 指定内容目录\n   content_dir: \"content\"\n\n   # 忽略的内容，如果是目录则以 / 结尾\n   ignored_content:\n     - \"drafts/\"\n   #+end_src\n\n*** Section\n    =content_dir= 目录下以 =_index.= 开头的文件都将识别为 =section= 结构，=secion= 下包括多篇文章\n    #+begin_example\n      content/\n      ├── _index.md           // \u003c- http://127.0.0.1:8000/index.html，包括content下所有默认语言的文章\n      ├── _index.en.md        // \u003c- http://127.0.0.1:8000/en/index.html，包括content下所有语言为en的文章\n      └── posts              // no url\n          ├── post1.org      // \u003c- http://127.0.0.1:8000/posts/2022/02/post1.html\n          └── subposts       //\n              └── _index.org // \u003c- http://127.0.0.1:8000/posts/subposts/index.html\n              └── post2.org  // \u003c- http://127.0.0.1:8000/posts/2023/02/post2.html\n    #+end_example\n**** 配置\n     #+begin_src yaml\n     sections:\n       _default:\n         # 页面默认排序, 多字段使用逗号分隔\n         sort_by: \"date desc\"\n         # 自定义某个section下的页面筛选\n         filter_by: \"\"\n         # 页面默认分页, path必须使用{number}变量, 0表示不分页\n         paginate: 10\n         # 分页路径\n         paginate_path: \"{name}{number}{extension}\"\n         # 分页前筛选pages\n         paginate_filter: \"\"\n         # 生成路径, 为空表示禁止生成相关页面\n         path: \"{section}/index.html\"\n         # 使用的模版\n         template: \"section.html\"\n         # section输出格式\n         formats.atom:\n           path: \"{section:slug}/atom.xml\"\n       en:\n         # en目录下的所有section都是en语言\n         lang: \"en\"\n     #+end_src\n\n     *filter_by* 格式(下同):\n     #+begin_example\n     'emacs' in tags and not draft or weight \u003e 1\n     #+end_example\n     其中 =tags=, =draft= 等都是 =FrontMatter=\n\n**** 路径变量(*sections.xxx.path*)\n     |-----------------+---------------------------------------|\n     | 变量             | 描述                                   |\n     |-----------------+---------------------------------------|\n     | {lang}          | section所属language                    |\n     | {lang:optional} | section所属language，如果是默认语言则为空 |\n     | {path}          | section所属路径                         |\n     | {path:slug}     | section所属路径, 转为slug               |\n     | {section}       | section名称                            |\n     | {section:slug}  | section slug, 中国 -\u003e zhong-guo        |\n\n**** 模版变量(*sections.xxx.template*)\n     |-------------------+-------------------------|\n     | 变量              | 描述                    |\n     |-------------------+-------------------------|\n     | section           |                         |\n     | section.Lang | section语言           |\n     | section.Slug |            |\n     | section.Title     | section标题             |\n     | section.Path      | section相对链接         |\n     | section.Permalink | section绝对链接         |\n     | section.Content   | section内容             |\n     | section.RawContent | section原始内容           |\n     | section.Pages     | 当前section下的页面列表 |\n     | section.Children  | 子section               |\n     | section.Formats | section输出的其它格式        |\n\n*** 页面(Page)\n**** 元数据\n     - markdown\n       #+begin_example\n       ---\n       title: \"title\"\n       categories:\n         - Snow/Templates\n       tags:\n         - linux\n         - snow\n       ---\n       #+end_example\n     - orgmode\n       #+begin_example\n       #+TITLE: title\n       #+DATE: 2022-02-26 17:14:46\n       #+CATEGORIES: Snow/Templates\n       #+PROPERTY: TAGS linux,snow\n       #+PROPERTY: MODIFIED 2023-02-26 14:35:37\n       #+end_example\n     - html\n       #+begin_src html\n       \u003chead\u003e\n         \u003ctitle\u003eProject\u003c/title\u003e\n         \u003cmeta name=\"categories\" content=\"Snow/Templates\" /\u003e\n         \u003cmeta name=\"tags\" content=\"linux,snow\" /\u003e\n         \u003cmeta name=\"date\" content=\"2015-12-22\" /\u003e\n       \u003c/head\u003e\n       #+end_src\n**** 配置\n     可以在配置文件设置页面的 =FrontMatter=，如果页面已有则忽略\n     #+begin_src yaml\n     pages:\n       _default:\n         comment: true\n       posts:\n         path: \"/articles/{date:%Y}/{date:%m}/{slug}.html\"\n         template: \"post.html\"\n         comment: true\n       pages:\n         hidden: true\n         path: \"/pages/{slug}.html\"\n         template: \"page.html\"\n       drafts:\n         draft: true\n       en:\n         lang: \"en\"\n         path: \"/en/articles/{date:%Y}/{date:%m}/{slug}.html\"\n         template: \"post.html\"\n       en/pages:\n         hidden: true\n         path: \"/en/pages/{slug}.html\"\n         template: \"page.html\"\n     #+end_src\n**** 路径变量(*sections.xxx.page_path*)\n     |-----------------+-----------------------------------|\n     | 变量             | 描述                               |\n     |-----------------+-----------------------------------|\n     | {lang}          | 页面语言                            |\n     | {lang:optional} | 页面所属language，如果是默认语言则为空 |\n     | {date:%Y}       | 创建页面的年份                      |\n     | {date:%m}       | 创建页面的月份                      |\n     | {date:%d}       | 创建页面的日期                      |\n     | {date:%H}       | 创建页面的小时                      |\n     | {path}          | 页面所属路径                        |\n     | {path:slug}     | 页面所属路径, 转为slug               |\n     | {slug}          | 页面标题或自定义slug                 |\n     | {title} | 页面标题                 |\n\n**** 模版变量(*sections.xxx.page_template*)\n     |----------------------+----------------------|\n     | 变量                 | 描述                 |\n     |----------------------+----------------------|\n     | page                 |                      |\n     | page.Title           | 页面标题             |\n     | page.Lang            | 页面语言             |\n     | page.Date            | 页面创建时间         |\n     | page.Modified        | 页面修改时间         |\n     | page.Aliases         | 页面其它链接         |\n     | page.Path            | 页面相对链接         |\n     | page.Permalink       | 页面绝对链接         |\n     | page.Summary         | 页面简介             |\n     | page.Content         | 页面内容             |\n     | page.FrontMatter.xxx        | 自定义的元数据       |\n\n*** 分类系统(Taxonomy)\n**** 配置\n     #+begin_src yaml\n     taxonomies:\n       _default:\n         # terms排序, 可选name,count\n         sort_by: \"\"\n         path: \"{taxonomy}/index.html\"\n         template: \"{taxonomy}/list.html\"\n         term_path: \"{taxonomy}/{term:slug}/index.html\"\n         term_template: \"{taxonomy}/single.html\"\n         # 页面列表筛选\n         term_filter_by: \"\"\n         # 页面列表排序\n         term_sort_by: \"date desc\"\n         # 页面列表分页\n         term_paginate: 0\n         term_paginate_path: \"\"\n         term_paginate_filter: \"\"\n       categories:\n       authors:\n       tags:\n     #+end_src\n\n**** 路径变量\n     - *taxonomies.xxx.path*\n       |-----------------+-----------------------------------|\n       | 变量             | 描述                               |\n       |-----------------+-----------------------------------|\n       | {lang}          | 分类所属语言                        |\n       | {lang:optional} | 分类所属语言，如果是默认语言则为空 |\n       | {taxonomy}      | 分类系统名称                        |\n     - *taxonomies.xxx.term_path*\n       |-------------+------------------|\n       | 变量        | 描述             |\n       |-------------+------------------|\n       | {lang}          | 分类所属语言                        |\n       | {lang:optional} | 分类所属语言，如果是默认语言则为空 |\n       | {taxonomy}  | 分类系统名称     |\n       | {term}      | 分类具体名称     |\n       | {term:slug} | 分类slug         |\n\n**** 模版变量\n     - *taxonomies.xxx.template*\n       |----------------+------------------------------------------|\n       | 变量           | 描述                                     |\n       |----------------+------------------------------------------|\n       | taxonomy       |                                          |\n       | taxonomy.Name  | 分类系统名称, 如:categories,tags,authors |\n       | taxonomy.Terms |                                          |\n     - *taxonomies.xxx.term_template*\n       |----------------+----------|\n       | 变量           | 描述     |\n       |----------------+----------|\n       | term           |          |\n       | term.Name      | 分类名称 |\n       | term.Path      | 相对链接 |\n       | term.Permalink | 绝对链接 |\n       | term.List      | 页面列表 |\n       | term.Children  | 子分类   |\n\n*** 归档页(Archive)\n    *snow* 中的分类系统是基于归档实现的，该功能类似 *SQL* 中的 =group by=, 所以如果要实现归档页可以有两种方式:\n    1. 添加 =taxonomies.{key}=, ={key}= 可以是页面元数据里的任意字段, 比如 =categories=, =tags=, 如果需要按照时间归档, 格式为 =date:2006/01=, 其中 =2006/01= 为Go时间格式，表示按年月归档, 并生成链接 */archives/2022/10/index.html*\n       #+begin_src yaml\n       taxonomies:\n         date:2006/01:\n           path: \"archives/index.html\"\n           template: \"archives.html\"\n           term_path: \"archives/{term}/index.html\"\n           term_template: \"period_archives.html\"\n       #+end_src\n    2. 在 ={content_dir}= 下添加一个 =archives.md= 的文件\n       #+begin_example\n       path: archives.html\n       template: archives.html\n       section: true\n       #+end_example\n       然后在模板 ={templates}/archives.html= 使用 =pages.GroupBy({key})=\n       #+begin_src html\n       {%- for subterm in pages.GroupBy(\"date:2006-01\").OrderBy(\"name desc\") %}\n         {%- set date = subterm.Name | split:\"-\" %}\n         {%- set year = date[0] %}\n         {%- set month = date[1] %}\n          ...\n       {%- endfor %}\n       #+end_src\n\n*** 分页(Pagination)\n**** 路径变量\n     |--------------+-------------------|\n     | 变量         | 描述              |\n     |--------------+-------------------|\n     | {name}       | 路径名称          |\n     | {extension}  | 路径扩展          |\n     | {number}     | 页码, 第一页为\"1\" |\n     | {number:optional} | 页码, 第一页为空 |\n     - 示例一:\n       #+begin_src yaml\n       path: \"section/index.html\"\n       paginate_path: \"{name}{number:optional}{extension}\"\n       #+end_src\n       - 第一页: =section/index.html=\n       - 第二页: =section/index2.html=\n       - 第三页: =section/index3.html=\n     - 示例二:\n       #+begin_src yaml\n       path: \"section/index.html\"\n       paginate_path: \"page/{number}{extension}\"\n       #+end_src\n       - 第一页: =section/page/1.html=\n       - 第二页: =section/page/2.html=\n       - 第三页: =section/page/3.html=\n**** 模版变量\n     |---------------------+----------------------|\n     | 变量                | 描述                 |\n     |---------------------+----------------------|\n     | paginator           |                      |\n     | paginator.Path   | 分页链接             |\n     | paginator.PageNum   | 当前页               |\n     | paginator.Total     | 总页数               |\n     | paginator.HasPrev() | 是否有上一页         |\n     | paginator.Prev      | 上一页               |\n     | paginator.Prev.URL  | 上一页链接           |\n     | paginator.HasNext() | 是否有下一页         |\n     | paginator.Next      | 下一页               |\n     | paginator.Next.URL  | 下一页链接           |\n     | paginator.All       | 所有页               |\n     | paginator.List      | 当前分页下的页面列表 |\n\n*** 草稿(Draft)\n    页面中的 =FrontMatter= 中的 =draft: true= 将会识别为草稿，如果不想每一篇草稿都添加相应字段，可以添加 =pages= 配置\n    #+begin_src yaml\n    pages:\n      drafts:\n        draft: true\n    #+end_src\n    配置表示 ={content_dir}/drafts= 该目录下的所有页面都将被识别为草稿。\n\n    构建时忽略草稿\n    1. 忽略草稿目录\n       #+begin_src yaml\n       ignored_content:\n         - \"drafts/\"\n       #+end_src\n    2. 使用命令行参数\n       #+begin_example\n       snow build --include-drafts\n       #+end_example\n\n*** 输出格式(Atom,Rss,JSON)\n    可以生成 *rss* ，*atom* 或者其它任意格式(需要自定义模版)\n**** 配置\n     #+begin_src yaml\n     # 设置rss格式的默认值\n     formats.rss:\n       template: \"rss.xml\"\n\n     formats.atom:\n       template: \"atom.xml\"\n\n     sections:\n       _default:\n         # rss生成路径, 模版将会使用默认模版\n         formats.rss.path: \"{section:slug}/index.xml\"\n         # 为空时禁止生成\n         formats.atom.path: \"\"\n\n     taxonomies:\n       tags:\n         formats.atom:\n           path: \"tags/{term:slug}/index.xml\"\n           # 自定义模版\n           template: \"custom.atom.xml\"\n     #+end_src\n**** 模版变量\n     |---------+--------------------------|\n     | 变量    | 描述                     |\n     |---------+--------------------------|\n     | section | 仅生成section 有效       |\n     | term    | 仅生成taxonomy term 有效 |\n     | pages   | 页面列表                 |\n\n*** 静态文件(Static)\n    静态文件分 *当前目录下静态文件* 和 *主题静态文件*\n    #+begin_src yaml\n    # 忽略的静态文件，如果是目录则以 / 结尾\n    ignored_static:\n      - \"extra/\"\n    #+end_src\n\n    当 =static/{filename}= 和 =themes/{theme}/static/{filename}= 同时存在时，优先当前目录下的文件\n\n*** 多语言(Multilingual)\n    需要配置 =languages=\n    #+begin_src yaml\n    languages.en:\n      translations: \"i18n/en.yaml\"\n      taxonomies:\n        special_tags:\n          path: \"{taxonomy}/index.html\"\n    languages.fr:\n      translations: \"i18n/fr.yaml\"\n    #+end_src\n    页面格式:\n    - ={title}.en.md=\n    - ={title}.fr.md=\n    或者可以在文件头指定 =lang: en=\n\n**** i18n\n     - 模版\n       #+begin_src html\n       {% i18n \"tags\" %}\n       {% T \"tags %d\" 12 %}\n       {{ i18n(\"authors\") }}\n       {{ T(\"authors\") }}\n       {{ _(\"authors %f\", 3.14) }}\n       #+end_src\n       甚至可以直接使用变量\n       {{ _(term.Name) }}\n     - 翻译文件\n       默认会加载主题下 *i18n* 目录下的文件\n       #+begin_example\n       i18n\n       ├── en.yaml\n       └── zh.yaml\n       #+end_example\n       文件内容\n       #+begin_src yaml\n       ---\n       - id: \"authors\"\n         tr: \"作者\"\n       - id: \"tags\"\n         tr: \"标签\"\n       #+end_src\n\n       也可以自定义文件位置或翻译内容覆盖主题原有的翻译\n       #+begin_src yaml\n       languages.en:\n         translations: \"i18n/en.yaml\"\n       languages.zh:\n         translations:\n           - id: \"authors\"\n             tr: \"作者\"\n       #+end_src\n\n** 模版(templates)\n   [[https://github.com/flosch/pongo2]]\n** 主题(theme)\n*** 安装\n*** 开发\n**** 主题目录结构\n     其中 *templates* 和 *static* 名称不可修改\n     #+begin_example\n       simple/\n       ├── theme.yaml\n       ├── templates\n       │   ├── post.html\n       │   ├── index.html\n       │   ├── archives.html\n       ├── static\n       │   ├── main.css\n     #+end_example\n**** 配置\n     #+begin_src yaml\n     theme:\n       # 主题名称, 未设置将使用默认主题\n       name: \"test-theme\"\n       # 默认的主题配置，该配置会自动合并，除非设置为空\n       config: \"theme.yaml\"\n       # 主题模版覆盖, 增加同名的文件到 *override* 配置的目录, snow将会优先使用该文件\n       override: \"layouts\"\n     #+end_src\n\n** 插件(hooks)\n*** rewrite\n    重写文章的 =FrontMatter= 字段，不用修改原文章的内容\n**** 配置插件\n     #+begin_src yaml\n     hooks.rewrite:\n       enabled: true\n     #+end_src\n\n     配置选项，如果设置 =type= 为 =list=，将会把原字段以 =逗号= 分隔进行转换\n     #+begin_src yaml\n     hooks.rewrite:\n       option:\n         - src: \"tag\"\n           dst: \"tags\"\n           type: \"list\"\n     #+end_src\n\n*** encrypt\n    文章内容加密\n**** 配置插件\n     #+begin_src yaml\n     hooks.encrypt:\n       enabled: true\n     #+end_src\n\n     配置选项\n     #+begin_src yaml\n     hooks.encrypt:\n       option:\n         password: \"默认密码\"\n         description: \"默认描述\"\n     #+end_src\n**** 在文章中使用\n     - 添加密码到 =frontmatter=\n       #+begin_src markdown\n       ---\n       password: \"123456\"\n       ---\n       #+end_src\n     - 局部加密：可以使用 =shortcodes= 中的 =encrypt= 功能\n       #+begin_src markdown\n       \u003cshortcode encrypt password=\"123456\"\u003e\n       加密的内容\n       \u003c/shortcode\u003e\n       #+end_src\n**** 在模版中使用\n     #+begin_src html\n     {{ page.Content | encrypt:\"123456\" }}\n     #+end_src\n\n*** shortcode\n    用于快速插入已有模版\n**** 配置插件\n     #+begin_src yaml\n     hooks.shortcode:\n       enabled: true\n     #+end_src\n**** 创建新的shortcode\n     在 =templates= 目录下添加 =shortcodes/bilibili.html=\n     #+begin_src html\n     \u003cdiv class=\"shortcodes-bilibili\"\u003e\n       \u003ciframe\n         src=\"https://player.bilibili.com/player.html?bvid={{ params.id }}\u0026page={% if params.page %}{{ params.page }}{% else %}1\u0026high_quality=1\u0026danmaku=0\u0026as_wide=0{% endif %}\u0026autoplay=0\"\n         scrolling=\"no\"\n         border=\"0\"\n         frameborder=\"no\"\n         framespacing=\"0\"\n         allowfullscreen=\"true\"\n       \u003e\n       \u003c/iframe\u003e\n     \u003c/div\u003e\n     #+end_src\n\n     模版内参数\n     - =name=: 当前 =shortcode= 的名称\n     - =params.*=: 传递的参数，比如 =params.id=\n     - =body=\n     - =counter=: 统计 =shortcode= 在当前文章中的使用次数\n**** 使用shortcode\n     #+begin_src html\n     \u003cbilibili id=\"BV1yB4cz8E9y\" /\u003e\n     #+end_src\n     或者\n     #+begin_src html\n     \u003cshortcode bilibili id=\"BV1yB4cz8E9y\" /\u003e\n     #+end_src\n\n*** assets\n    静态文件处理，区别于 =static= 目录, =assets= 目录支持合并，压缩等功能\n    #+begin_example\n    mysite/\n    ├── assets\n    │   ├── js\n    │   │   ├── main.js\n    │   │   └── theme.js\n    │   ├── scss\n    │   │   ├── _variables.scss\n    │   │   ├── entry.scss\n    │   │   ├── prose.scss\n    │   │   ├── style.scss\n    │   │   ├── theme.scss\n    │   ├── css\n    │   │   ├── custom.css\n    #+end_example\n\n**** 配置插件\n     #+begin_src yaml\n     hooks.assets:\n       enabled: true\n     #+end_src\n\n     配置选项\n     #+begin_src yaml\n     hooks.assets:\n       ...\n       option.css:\n         files:\n           - \"scss/style.scss\"\n           - \"css/custom.css\"\n         filters:\n           - \"cssmin\"\n         output: \"static/lib.min.css\"\n     #+end_src\n     如果文件以 =.scss= 或者 =.sass=，将自动编译为 =.css=\n\n**** 在模版中使用\n     - 使用配置的名称 =css=\n       #+begin_src html\n       {% assets css %}\n       \u003clink rel=\"stylesheet\" href=\"{{ config.base_url }}/{{ asset_url }}\"\u003e\n       {% endassets %}\n       #+end_src\n\n     - 在模版中调用 =assets=\n       #+begin_src html\n       {% assets files=\"css/style.scss\" filters=\"cssmin\" output=\"css/style.min.css\" %}\n       \u003clink rel=\"stylesheet\" href=\"{{ config.base_url }}/{{ asset_url }}\"\u003e\n       {% endassets %}\n       #+end_src\n\n*** minify\n    *minify* 允许对写入的=html=、=css=、=js=文件进行压缩\n**** 配置插件\n     #+begin_src yaml\n     hooks.minify:\n       enabled: true\n     #+end_src\n     配置选项\n     #+begin_src yaml\n     hooks.minify:\n       option:\n         js: true\n         css: true\n         html: true\n     #+end_src\n\n** 本地测试和正式发布\n   *snow* 提供了 *mode* 配置用于区分本地测试和正式发布\n   #+begin_src yaml :noindent\n   base_url: \"http://127.0.0.1:8000\"\n\n   modes.publish:\n     base_url: \"https://example.com\"\n\n   modes.develop:\n     include: \"develop.yaml\"\n   #+end_src\n   只要在构建时使用 =snow build --mode publish= 即可覆盖本地默认配置\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonmaple%2Fsnow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhonmaple%2Fsnow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhonmaple%2Fsnow/lists"}