Files

79 lines
32 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html><head><link rel=stylesheet href=https://geekifan.github.io/chirpy-starter/css/main.min.6135c0700b2b81f4338a5c119b7a78b2bd20208c6f27ae64a19d0ef65cba906c.css></head><html lang=zh-CN><head><meta charset=utf-8><meta name=theme-color media="(prefers-color-scheme: light)" content="#f7f7f7"><meta name=theme-color media="(prefers-color-scheme: dark)" content="#1b1b1e"><meta name=mobile-web-app-capable content="yes"><meta name=apple-mobile-web-app-status-bar-style content="black-translucent"><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1,shrink-to-fit=no,viewport-fit=cover"><meta property="og:url" content="https://geekifan.github.io/chirpy-starter/zh-cn/post/2019-08-09-getting-started/"><meta property="og:site_name" content="Chirpy"><meta property="og:title" content="开始使用"><meta property="og:description" content="通过这个全面概述开始学习Chirpy的基础知识。 您将学习如何安装、配置和使用您的第一个基于Chirpy的网站以及如何将其部署到网络服务器。"><meta property="og:locale" content="zh_CN"><meta property="og:type" content="article"><meta property="article:section" content="post"><meta property="article:published_time" content="2019-08-09T20:55:00+08:00"><meta property="article:modified_time" content="2019-08-09T20:55:00+08:00"><meta property="article:tag" content="入门指南"><meta name=twitter:card content="summary"><meta name=twitter:title content="开始使用"><meta name=twitter:description content="通过这个全面概述开始学习Chirpy的基础知识。 您将学习如何安装、配置和使用您的第一个基于Chirpy的网站以及如何将其部署到网络服务器。"><meta itemprop=name content="开始使用"><meta itemprop=description content="通过这个全面概述开始学习Chirpy的基础知识。 您将学习如何安装、配置和使用您的第一个基于Chirpy的网站以及如何将其部署到网络服务器。"><meta itemprop=datePublished content="2019-08-09T20:55:00+08:00"><meta itemprop=dateModified content="2019-08-09T20:55:00+08:00"><meta itemprop=wordCount content="1990"><meta itemprop=keywords content="入门指南"><title>开始使用 |
Chirpy</title><link rel=apple-touch-icon sizes=180x180 href=/chirpy-starter/img/favicons/apple-touch-icon.png><link rel=icon type=image/png sizes=32x32 href=/chirpy-starter/img/favicons/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/chirpy-starter/img/favicons/favicon-16x16.png><link rel="shortcut icon" href=/chirpy-starter/img/favicons/favicon.ico><meta name=apple-mobile-web-app-title content="Chirpy"><meta name=application-name content="Chirpy"><meta name=msapplication-TileColor content="#da532c"><meta name=msapplication-config content="/chirpy-starter/img/favicons/browserconfig.xml"><meta name=theme-color content="#ffffff"><link rel=preconnect href=https://fonts.googleapis.com><link rel=dns-prefetch href=https://fonts.googleapis.com><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=dns-prefetch href=https://fonts.gstatic.com><link rel=preconnect href=https://cdn.jsdelivr.net><link rel=dns-prefetch href=https://cdn.jsdelivr.net><link rel=stylesheet href=https://geekifan.github.io/chirpy-starter/css/main.min.6135c0700b2b81f4338a5c119b7a78b2bd20208c6f27ae64a19d0ef65cba906c.css><link rel=stylesheet href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400&amp;family=Source+Sans+Pro:wght@400;600;700;900&amp;display=swap"><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.7.1/css/all.min.css><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/tocbot@4.32.2/dist/tocbot.min.css><link rel=stylesheet href=/chirpy-starter/><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/css/glightbox.min.css><script src=/chirpy-starter/js/modules/theme.js></script><script src=https://cdn.jsdelivr.net/npm/glightbox@3.3.0/dist/js/glightbox.min.js></script><script src=https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js></script><script src=https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js></script><script src=https://cdn.jsdelivr.net/npm/dayjs@1.11.13/locale/zh-cn.js></script><script src=https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/relativeTime.js></script><script src=https://cdn.jsdelivr.net/npm/dayjs@1.11.13/plugin/localizedFormat.js></script><script src=https://cdn.jsdelivr.net/npm/tocbot@4.32.2/dist/tocbot.min.js></script><script defer src=/chirpy-starter/js/post.js></script></head><body><aside aria-label=Sidebar id=sidebar class="d-flex flex-column align-items-end"><header class=profile-wrapper><a href=/chirpy-starter/zh-cn/ id=avatar class=rounded-circle><img src=/chirpy-starter/img/commons/avatar.jpg width=112 height=112 alt=avatar onerror='this.style.display="none"'></a>
<a class="site-title d-block" href=/chirpy-starter/zh-cn/>Chirpy</a><p class="site-subtitle fst-italic mb-0">一个专注于文本的博客主题</p></header><nav class="flex-column flex-grow-1 w-100 ps-0"><ul class=nav><li class=nav-item><a href=/chirpy-starter/zh-cn/ class=nav-link><i class="fa-fw fas fa-house"></i>
<span>主页</span></a></li><li class=nav-item><a href=/chirpy-starter/zh-cn/categories/ class=nav-link><i class="fa-fw fas fa-stream"></i>
<span>分类</span></a></li><li class=nav-item><a href=/chirpy-starter/zh-cn/tags/ class=nav-link><i class="fa-fw fas fa-tags"></i>
<span>标签</span></a></li><li class=nav-item><a href=/chirpy-starter/zh-cn/archives/ class=nav-link><i class="fa-fw fas fa-archive"></i>
<span>归档</span></a></li><li class=nav-item><a href=/chirpy-starter/zh-cn/about/ class=nav-link><i class="fa-fw fas fa-info-circle"></i>
<span>关于</span></a></li><li class="nav-item mt-4"><a class="nav-link no-hover"><i class="fa-fw fas fa-language"></i><div class=lang-dropdown><select class=lang-select onchange="location=this.value"><option value=https://geekifan.github.io/chirpy-starter/zh-cn/ selected>中文</option><option value=https://geekifan.github.io/chirpy-starter/en/>English</option></select></div></a></li></ul></nav><div class="sidebar-bottom d-flex flex-wrap align-items-center w-100"><button type=button class="btn btn-link nav-link" aria-label="Switch Mode" id=mode-toggle>
<i class="fas fa-adjust"></i>
</button>
<span class=icon-border></span>
<a href=https://github.com/yourusername aria-label=github target=_blank rel="noopener noreferrer"><i class="fab fa-github"></i>
</a><a href=https://twitter.com/yourhandle aria-label=twitter target=_blank rel="noopener noreferrer"><i class="fab fa-twitter"></i>
</a><a href=mailto:your.email@example.com aria-label=email target=_blank rel="noopener noreferrer"><i class="fas fa-envelope"></i>
</a><a href=https://geekifan.github.io/chirpy-starter/zh-cn/index.xml aria-label=rss><i class="fas fa-rss"></i></a></div></aside><div id=main-wrapper class="d-flex justify-content-center"><div class="container d-flex flex-column px-xxl-5"><header id=topbar-wrapper class=flex-shrink-0 aria-label="Top Bar"><div id=topbar class="d-flex align-items-center justify-content-between px-lg-3 h-100"><nav id=breadcrumb aria-label=Breadcrumb><span><a href=/chirpy-starter/zh-cn/>首页</a>
</span><span>开始使用</span></nav><button type=button id=sidebar-trigger class="btn btn-link" aria-label=Sidebar>
<i class="fas fa-bars fa-fw"></i></button><div id=topbar-title>开始使用</div><button type=button id=search-trigger class="btn btn-link" aria-label=Search>
<i class="fas fa-search fa-fw"></i>
</button>
<search id=search class="align-items-center ms-3 ms-lg-0"><i class="fas fa-search fa-fw"></i>
<input class=form-control id=search-input type=search aria-label=search autocomplete=off placeholder=搜索...>
</search><button type=button class="btn btn-link text-decoration-none" id=search-cancel>取消</button></div></header><div class="row flex-grow-1"><main aria-label="Main Content" class="col-12 col-lg-11 col-xl-9 px-md-4"><article class=px-1 data-toc=true><header><h1 data-toc-skip>开始使用</h1><p class="post-desc fw-light mb-4">通过这个全面概述开始学习Chirpy的基础知识。 您将学习如何安装、配置和使用您的第一个基于Chirpy的网站以及如何将其部署到网络服务器。</p><div class="post-meta text-muted"><span>发表于
<time data-ts=1565355300 data-df=YYYY/MM/DD data-bs-toggle=tooltip data-bs-placement=bottom>%Y/%m/%d</time></span><div class="d-flex justify-content-between"><span>作者
<em><a href=https://github.com/geekifan>一凡</a></em></span><div><span class=readtime data-bs-toggle=tooltip data-bs-placement=bottom title="494 字"><em>2 分钟</em> 阅读</span></div></div></div></header><div id=toc-bar class="d-flex align-items-center justify-content-between invisible"><span class="label text-truncate">开始使用</span>
<button type=button class="toc-trigger btn me-1">
<i class="fa-solid fa-list-ul fa-fw"></i></button></div><button id=toc-solo-trigger type=button class="toc-trigger btn btn-outline-secondary btn-sm">
<span class="label ps-2 pe-1">文章内容</span>
<i class="fa-solid fa-angle-right fa-fw"></i>
</button>
<dialog id=toc-popup class=p-0><div class="header d-flex flex-row align-items-center justify-content-between"><div class="label text-truncate py-2 ms-4">开始使用</div><button id=toc-popup-close type=button class="btn mx-1 my-1 opacity-75">
<i class="fas fa-close"></i></button></div><div id=toc-popup-content class="px-4 py-3 pb-4"><nav id=TableOfContents><ul><li><a href=#创建站点仓库>创建站点仓库</a><ul><li><a href=#选项1-使用起始模板推荐>选项1. 使用起始模板(推荐)</a></li><li><a href=#选项2-复刻主题>选项2. 复刻主题</a></li></ul></li><li><a href=#设置环境>设置环境</a><ul><li><a href=#使用开发容器windows系统推荐>使用开发容器Windows系统推荐</a></li><li><a href=#本地设置类unix操作系统推荐>本地设置类Unix操作系统推荐</a></li></ul></li><li><a href=#使用方法>使用方法</a><ul><li><a href=#启动jekyll服务器>启动Jekyll服务器</a></li><li><a href=#配置>配置</a></li><li><a href=#社交联系选项>社交联系选项</a></li><li><a href=#自定义样式表>自定义样式表</a></li><li><a href=#自定义静态资源>自定义静态资源</a></li></ul></li><li><a href=#部署>部署</a><ul><li><a href=#使用github-actions部署>使用Github Actions部署</a></li><li><a href=#手动构建和部署>手动构建和部署</a></li></ul></li></ul></nav></div></dialog><div class=content><blockquote class=prompt-warning><p><strong>NOTE:</strong> 该教程还没有完成从 Jekyll 版本的迁移,请谨慎参考。</p></blockquote><h2 id=创建站点仓库 id=创建站点仓库><span class=me-2>创建站点仓库</span>
<a href=#%e5%88%9b%e5%bb%ba%e7%ab%99%e7%82%b9%e4%bb%93%e5%ba%93 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h2><p>创建站点仓库时,根据您的需求有两种选择:</p><h3 id=选项1-使用起始模板推荐 id=选项1-使用起始模板推荐><span class=me-2>选项1. 使用起始模板(推荐)</span>
<a href=#%e9%80%89%e9%a1%b91-%e4%bd%bf%e7%94%a8%e8%b5%b7%e5%a7%8b%e6%a8%a1%e6%9d%bf%e6%8e%a8%e8%8d%90 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>这种方法简化了升级过程,隔离了不必要的文件,非常适合那些想专注于写作而不需要太多配置的用户。</p><ol><li>登录GitHub并导航到<a href=https://github.com/cotes2020/chirpy-starter><strong>起始模板</strong></a></li><li>点击<kbd>Use this template</kbd>按钮,然后选择<kbd>Create a new repository</kbd></li><li>将新仓库命名为<code>&lt;username>.github.io</code>,其中<code>username</code>替换为您的小写GitHub用户名。</li></ol><h3 id=选项2-复刻主题 id=选项2-复刻主题><span class=me-2>选项2. 复刻主题</span>
<a href=#%e9%80%89%e9%a1%b92-%e5%a4%8d%e5%88%bb%e4%b8%bb%e9%a2%98 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>这种方法便于修改功能或UI设计但在升级时会遇到挑战。除非您熟悉Jekyll并计划对此主题进行大量修改否则不要尝试这种方法。</p><ol><li>登录GitHub。</li><li><a href=https://github.com/cotes2020/jekyll-theme-chirpy/fork>复刻主题仓库</a></li><li>将新仓库命名为<code>&lt;username>.github.io</code>,其中<code>username</code>替换为您的小写GitHub用户名。</li></ol><h2 id=设置环境 id=设置环境><span class=me-2>设置环境</span>
<a href=#%e8%ae%be%e7%bd%ae%e7%8e%af%e5%a2%83 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h2><p>创建仓库后,是时候设置您的开发环境了。主要有两种方法:</p><h3 id=使用开发容器windows系统推荐 id=使用开发容器windows系统推荐><span class=me-2>使用开发容器Windows系统推荐</span>
<a href=#%e4%bd%bf%e7%94%a8%e5%bc%80%e5%8f%91%e5%ae%b9%e5%99%a8windows%e7%b3%bb%e7%bb%9f%e6%8e%a8%e8%8d%90 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>开发容器使用Docker提供隔离环境这可以防止与您的系统冲突并确保所有依赖项都在容器内管理。</p><p><strong>步骤</strong>:</p><ol><li>安装Docker<ul><li>在Windows/macOS上安装<a href=https://www.docker.com/products/docker-desktop/>Docker Desktop</a></li><li>在Linux上安装<a href=https://docs.docker.com/engine/install/>Docker Engine</a></li></ul></li><li>安装<a href=https://code.visualstudio.com/>VS Code</a><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers">Dev Containers扩展</a></li><li>克隆您的仓库:<ul><li>对于Docker Desktop启动VS Code并<a href=https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-a-git-repository-or-github-pr-in-an-isolated-container-volume>在容器卷中克隆您的仓库</a></li><li>对于Docker Engine在本地克隆您的仓库然后通过VS Code<a href=https://code.visualstudio.com/docs/devcontainers/containers#_quick-start-open-an-existing-folder-in-a-container>在容器中打开它</a></li></ul></li><li>等待开发容器设置完成。</li></ol><h3 id=本地设置类unix操作系统推荐 id=本地设置类unix操作系统推荐><span class=me-2>本地设置类Unix操作系统推荐</span>
<a href=#%e6%9c%ac%e5%9c%b0%e8%ae%be%e7%bd%ae%e7%b1%bbunix%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f%e6%8e%a8%e8%8d%90 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>对于类Unix系统您可以本地设置环境以获得最佳性能不过您也可以使用开发容器作为替代方案。</p><p><strong>步骤</strong>:</p><ol><li>按照<a href=https://jekyllrb.com/docs/installation/>Jekyll安装指南</a>安装Jekyll并确保已安装<a href=https://git-scm.com/>Git</a></li><li>将您的仓库克隆到本地机器。</li><li>如果您复刻了主题,安装<a href=https://nodejs.org/>Node.js</a>并在根目录中运行<code>bash tools/init.sh</code>来初始化仓库。</li><li>在仓库根目录中运行命令<code>bundle</code>来安装依赖项。</li></ol><h2 id=使用方法 id=使用方法><span class=me-2>使用方法</span>
<a href=#%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h2><h3 id=启动jekyll服务器 id=启动jekyll服务器><span class=me-2>启动Jekyll服务器</span>
<a href=#%e5%90%af%e5%8a%a8jekyll%e6%9c%8d%e5%8a%a1%e5%99%a8 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>要在本地运行站点,请使用以下命令:</p><div class=code-block><div class=code-header><span data-label-text=Terminal><i class="fas fa-code fa-fw small"></i></span> <button aria-label=copy data-title-succeed=Copied!><i class="far fa-clipboard"></i></button></div><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre tabindex=0 class=chroma><code><span class=lnt>1
</span></code></pre></td><td class=lntd><pre tabindex=0 class=chroma><code class=language-fallback data-lang=fallback><span class=line><span class=cl>$ bundle exec jekyll serve</span></span></code></pre></td></tr></table></div></div></div><blockquote><p>如果您使用的是开发容器,必须在<strong>VS Code</strong>终端中运行该命令。
{: .prompt-info }</p></blockquote><p>几秒钟后,本地服务器将在<a href=http://127.0.0.1:4000>http://127.0.0.1:4000</a>上可用。</p><h3 id=配置 id=配置><span class=me-2>配置</span>
<a href=#%e9%85%8d%e7%bd%ae class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>根据需要更新<code>_config.yml</code>{: .filepath}中的变量。一些典型选项包括:</p><ul><li><code>url</code></li><li><code>avatar</code></li><li><code>timezone</code></li><li><code>lang</code></li></ul><h3 id=社交联系选项 id=社交联系选项><span class=me-2>社交联系选项</span>
<a href=#%e7%a4%be%e4%ba%a4%e8%81%94%e7%b3%bb%e9%80%89%e9%a1%b9 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>社交联系选项显示在侧边栏底部。您可以在<code>_data/contact.yml</code>{: .filepath}文件中启用或禁用特定联系方式。</p><h3 id=自定义样式表 id=自定义样式表><span class=me-2>自定义样式表</span>
<a href=#%e8%87%aa%e5%ae%9a%e4%b9%89%e6%a0%b7%e5%bc%8f%e8%a1%a8 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>要自定义样式表,请将主题的<code>assets/css/jekyll-theme-chirpy.scss</code>{: .filepath}文件复制到Jekyll站点的相同路径中并在文件末尾添加您的自定义样式。</p><h3 id=自定义静态资源 id=自定义静态资源><span class=me-2>自定义静态资源</span>
<a href=#%e8%87%aa%e5%ae%9a%e4%b9%89%e9%9d%99%e6%80%81%e8%b5%84%e6%ba%90 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>静态资源配置在版本<code>5.1.0</code>中引入。静态资源的CDN在<code>_data/origin/cors.yml</code>{: .filepath}中定义。您可以根据您的网站发布地区的网络状况替换其中一些。</p><p>如果您更喜欢自托管静态资源,请参考<a href=https://github.com/cotes2020/chirpy-static-assets#readme><em>chirpy-static-assets</em></a>仓库。</p><h2 id=部署 id=部署><span class=me-2>部署</span>
<a href=#%e9%83%a8%e7%bd%b2 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h2><p>部署前,检查<code>_config.yml</code>{: .filepath}文件并确保正确配置了<code>url</code>。如果您更喜欢<a href=https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites><strong>项目站点</strong></a>且不使用自定义域名或者您想通过GitHub Pages以外的Web服务器上的基本URL访问您的网站请记得将<code>baseurl</code>设置为项目名称,以斜杠开头,例如<code>/project-name</code></p><p>现在您可以选择以下方法之一来部署您的Jekyll站点。</p><h3 id=使用github-actions部署 id=使用github-actions部署><span class=me-2>使用Github Actions部署</span>
<a href=#%e4%bd%bf%e7%94%a8github-actions%e9%83%a8%e7%bd%b2 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>准备以下内容:</p><ul><li><p>如果您使用的是GitHub免费计划请保持站点仓库公开。</p></li><li><p>如果您已将<code>Gemfile.lock</code>{: .filepath}提交到仓库并且您的本地机器不是运行Linux请更新锁定文件的平台列表</p><div class=code-block><div class=code-header><span data-label-text=Console><i class="fas fa-code fa-fw small"></i></span> <button aria-label=copy data-title-succeed=Copied!><i class="far fa-clipboard"></i></button></div><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre tabindex=0 class=chroma><code><span class=lnt>1
</span></code></pre></td><td class=lntd><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> bundle lock --add-platform x86_64-linux
</span></span></code></pre></td></tr></table></div></div></div></li></ul><p>接下来配置_Pages_服务</p><ol><li>在GitHub上进入您的仓库。选择_Settings_标签然后点击左侧导航栏中的_Pages_。在<strong>Source</strong>部分_Build and deployment_下从下拉菜单中选择<a href=https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow><strong>GitHub Actions</strong></a></li></ol><a href=/chirpy-starter/post/2019-08-09-getting-started/pages-source-light.png class="popup img-link light border normal"><img src=/chirpy-starter/post/2019-08-09-getting-started/pages-source-light.png alt=构建源 height=140 width=375>
</a><a href=/chirpy-starter/post/2019-08-09-getting-started/pages-source-dark.png class="popup img-link dark normal"><img src=/chirpy-starter/post/2019-08-09-getting-started/pages-source-dark.png alt=构建源 height=140 width=375></a><ol start=2><li>将任何提交推送到GitHub以触发_Actions_工作流。在仓库的_Actions_标签中您应该看到正在运行的_Build and Deploy_工作流。一旦构建完成并成功站点将自动部署。</li></ol><p>现在您可以访问GitHub提供的URL来访问您的站点。</p><h3 id=手动构建和部署 id=手动构建和部署><span class=me-2>手动构建和部署</span>
<a href=#%e6%89%8b%e5%8a%a8%e6%9e%84%e5%bb%ba%e5%92%8c%e9%83%a8%e7%bd%b2 class="anchor text-muted"><i class="fas fa-hashtag"></i></a></h3><p>对于自托管服务器,您需要在本地机器上构建站点,然后将站点文件上传到服务器。</p><p>导航到源项目的根目录,并使用以下命令构建您的站点:</p><div class=code-block><div class=code-header><span data-label-text=Console><i class="fas fa-code fa-fw small"></i></span> <button aria-label=copy data-title-succeed=Copied!><i class="far fa-clipboard"></i></button></div><div class=highlight><div class=chroma><table class=lntable><tr><td class=lntd><pre tabindex=0 class=chroma><code><span class=lnt>1
</span></code></pre></td><td class=lntd><pre tabindex=0 class=chroma><code class=language-console data-lang=console><span class=line><span class=cl><span class=gp>$</span> <span class=nv>JEKYLL_ENV</span><span class=o>=</span>production bundle <span class=nb>exec</span> jekyll b
</span></span></code></pre></td></tr></table></div></div></div><p>除非您指定了输出路径,否则生成的站点文件将放置在项目根目录的<code>_site</code>{: .filepath}文件夹中。将这些文件上传到您的目标服务器。</p></div><div class="post-tail-wrapper text-muted"><div class="post-meta mb-3"><i class="far fa-folder-open fa-fw me-1"></i>
<a href=/zh-cn/categories/%E5%8D%9A%E5%AE%A2/>博客</a>
,
<a href=/zh-cn/categories/%E5%8D%9A%E5%AE%A2/%E6%95%99%E7%A8%8B/>教程</a></div><div class=post-tags><i class="fa fa-tags fa-fw me-1"></i>
<a href=/zh-cn/tags/%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97/ class="post-tag no-text-decoration">入门指南</a></div><div class="post-tail-bottom d-flex justify-content-between align-items-center mt-5 pb-2"><div class=license-wrapper>本文由作者按照 <a href=https://creativecommons.org/licenses/by/4.0/>CC BY 4.0</a> 进行授权</div></div></div></article></main><aside aria-label=Panel id=panel-wrapper class="col-xl-3 ps-2 text-muted"><div class=access><section id=access-lastmod><h2 class=panel-heading>最近更新</h2><ul class="content list-unstyled ps-0 pb-1 ms-1 mt-2"><li class="text-truncate lh-lg"><a href=/chirpy-starter/zh-cn/post/2019-08-11-customize-the-favicon/>自定义网站图标</a></li><li class="text-truncate lh-lg"><a href=/chirpy-starter/zh-cn/post/2019-08-09-getting-started/>开始使用</a></li><li class="text-truncate lh-lg"><a href=/chirpy-starter/zh-cn/post/2019-08-08-write-a-new-post/>撰写新文章</a></li><li class="text-truncate lh-lg"><a href=/chirpy-starter/zh-cn/post/2019-08-08-text-and-typography/>文本和排版</a></li></ul></section><section><h2 class=panel-heading>热门标签</h2><div class="d-flex flex-wrap mt-3 mb-1 me-3"><a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E6%8E%92%E7%89%88/>排版</a>
<a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97/>入门指南</a>
<a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E7%BD%91%E7%AB%99%E5%9B%BE%E6%A0%87/>网站图标</a>
<a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E5%86%99%E4%BD%9C/>写作</a></div></section></div><div class="toc-border-cover z-3"></div><section id=toc-wrapper class="invisible position-sticky ps-0 pe-4 pb-4"><h2 class="panel-heading ps-3 pb-2 mb-0">文章内容</h2><nav id=toc></nav></section></aside></div><div class=row><div id=tail-wrapper class="col-12 col-lg-11 col-xl-9 px-md-4"><aside id=related-posts aria-labelledby=related-label><h3 class=mb-4 id=related-label>相关文章</h3><nav class="row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4 mb-4"><article class=col><a href=/chirpy-starter/zh-cn/post/2019-08-08-write-a-new-post/ class="post-preview card h-100"><div class=card-body><time data-ts=1565244600 data-df=YYYY/MM/DD>%Y/%m/%d</time><h4 class="pt-0 my-2">撰写新文章</h4><div class=text-muted><p>本教程将指导您如何在 Chirpy 模板中撰写文章,即使您以前使用过 Hugo也值得阅读因为许多功能需要设置特定变量。 &amp;lt;span class=&amp;quot;me-2&amp;quot;&amp;gt;命名和路径&amp;lt;/span&amp;gt; &amp;lt;a href=&amp;quot;#%e5%91%bd%e5%90%8d%e5%92%8c%e8%b7%af%e5%be%84&amp;quot; …</p></div></div></a></article><article class=col><a href=/chirpy-starter/zh-cn/post/2019-08-11-customize-the-favicon/ class="post-preview card h-100"><div class=card-body><time data-ts=1565454840 data-df=YYYY/MM/DD>%Y/%m/%d</time><h4 class="pt-0 my-2">自定义网站图标</h4><div class=text-muted><p>通过这个全面概述开始学习 Chirpy 的基础知识。 您将学习如何安装、配置和使用您的第一个基于 Chirpy 的网站,以及如何将其部署到网络服务器。</p></div></div></a></article><article class=col><a href=/chirpy-starter/zh-cn/post/2019-08-08-text-and-typography/ class="post-preview card h-100"><div class=card-body><time data-ts=1565235180 data-df=YYYY/MM/DD>%Y/%m/%d</time><h4 class="pt-0 my-2">文本和排版</h4><div class=text-muted><p>文本、排版、数学公式、图表、流程图、图片、视频等示例。</p></div></div></a></article></nav></aside><nav class="post-navigation d-flex justify-content-between" aria-label="Post Navigation"><a href=/chirpy-starter/zh-cn/post/2019-08-08-write-a-new-post/ class="btn btn-outline-primary" aria-label=上一篇><p>撰写新文章</p></a><a href=/chirpy-starter/zh-cn/post/2019-08-11-customize-the-favicon/ class="btn btn-outline-primary" aria-label=下一篇><p>自定义网站图标</p></a></nav><footer aria-label="Site Info" class="d-flex flex-column justify-content-center text-muted
flex-lg-row justify-content-lg-between align-items-lg-center pb-lg-3"><p>©
<time>2025</time>
<a href=https://github.com/geekifan>Yifan</a>.
<span data-bs-toggle=tooltip data-bs-placement=top title="除非另有说明,本网站上的博客文章均由作者按照知识共享署名 4.0 国际 (CC BY 4.0) 许可协议进行授权。">保留部分权利。</span></p><p>本站采用 <a href=https://gohugo.io/ target=_blank rel=noopener>Hugo</a> 主题 <a data-bs-toggle=tooltip data-bs-placement=top title=v1.0.2 href=https://github.com/geekifan/hugo-theme-chirpy target=_blank rel=noopener>Chirpy</a></p></footer></div></div><div id=search-result-wrapper class="d-flex justify-content-center d-none"><div class="col-11 content"><div id=search-hints><section><h2 class=panel-heading>热门标签</h2><div class="d-flex flex-wrap mt-3 mb-1 me-3"><a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E6%8E%92%E7%89%88/>排版</a>
<a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E5%85%A5%E9%97%A8%E6%8C%87%E5%8D%97/>入门指南</a>
<a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E7%BD%91%E7%AB%99%E5%9B%BE%E6%A0%87/>网站图标</a>
<a class="post-tag btn btn-outline-primary" href=https://geekifan.github.io/chirpy-starter/zh-cn/tags/%E5%86%99%E4%BD%9C/>写作</a></div></section></div><div id=search-results class="d-flex flex-wrap justify-content-center text-muted mt-3"></div></div></div><script>const DEFAULT_CONFIG={search:{minChars:1,maxResults:5,fields:{title:!0,description:!0,section:!0,contents:!0},strictMode:!0}};class FastSearch{constructor({searchInput:e,resultsContainer:t,json:n,searchResultTemplate:s=null,noResultsText:o=null}){this.searchInput=e,this.resultsContainer=t,this.json=n,this.searchResultTemplate=s,this.noResultsText=o,this.init()}init(){this.loadSearchIndex(),this.searchInput.addEventListener("input",e=>{if(!this.searchIndex){this.resultsContainer.innerHTML='<li class="search-message">Loading search index...</li>';return}this.performSearch(this.searchInput.value)})}async loadSearchIndex(){try{const e=await fetch(this.json);if(!e.ok)throw new Error("Failed to load search index");const t=await e.json();this.searchIndex=t.map(e=>({...e,searchableTitle:e.title?.toLowerCase()||"",searchableDesc:e.desc?.toLowerCase()||"",searchableSection:e.section?.toLowerCase()||"",searchableContents:e.contents?.toLowerCase()||""}))}catch(e){console.error("Error loading search index:",e),this.resultsContainer.innerHTML='<li class="search-message">Error loading search index...</li>'}}escapeHtml(e){return e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""}containsTerm(e,t){return!!e&&!!t&&e.includes(t)}performSearch(e){if(e=e.toLowerCase().trim(),!e||!this.searchIndex||e.length<DEFAULT_CONFIG.search.minChars){this.resultsContainer.innerHTML="";return}const s=[e,...e.split(/\s+/).filter(e=>e.length>0)],t=[...new Set(s)],o=DEFAULT_CONFIG.search.strictMode,n=this.searchIndex.map(e=>{const s=this.checkFieldsForMatch(e,t[0]);if(o&&!s)return{item:e,score:0,matched:!1};let n=0,i=0,a=!1;t.forEach((t,s)=>{const r=s===0,o=this.checkFieldsForMatch(e,t);o&&(i++,o.inTitle&&(n+=r?10:5,a=!0),o.inDesc&&(n+=r?8:4),o.inSection&&(n+=r?6:3),o.inContents&&(n+=r?4:2))});const r=i/t.length,c=n*r*(a?1.5:1);return{item:e,score:c,matched:s}}).filter(e=>e.matched).sort((e,t)=>t.score-e.score).slice(0,DEFAULT_CONFIG.search.maxResults).map(e=>e.item);if(n.length===0){this.resultsContainer.innerHTML='<p class="mt-5">搜索结果为空</p>';return}const i=n.map(e=>{let t="",n="";return e.categories&&(t=e.categories.join(", "),t=`<div class="me-sm-4"><i class="far fa-folder fa-fw"></i>${t}</div>`),e.tags&&(n=e.tags.join(", "),n=`<div><i class="fa fa-tag fa-fw"></i>${n}</div>`),`
<article class="px-1 px-sm-2 px-lg-4 px-xl-0">
<header>
<h2><a href="${this.escapeHtml(e.permalink)}">${this.escapeHtml(e.title)}</a></h2>
<div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
${t}
${n}
</div>
</header>
<p>${this.escapeHtml(e.contents)}</p>
</article>
`}).join("");this.resultsContainer.innerHTML=i}checkFieldsForMatch(e,t){const n={inTitle:!1,inDesc:!1,inSection:!1,inContents:!1};return DEFAULT_CONFIG.search.fields.title&&this.containsTerm(e.searchableTitle,t)&&(n.inTitle=!0),DEFAULT_CONFIG.search.fields.description&&this.containsTerm(e.searchableDesc,t)&&(n.inDesc=!0),DEFAULT_CONFIG.search.fields.section&&this.containsTerm(e.searchableSection,t)&&(n.inSection=!0),DEFAULT_CONFIG.search.fields.contents&&this.containsTerm(e.searchableContents,t)&&(n.inContents=!0),!!(n.inTitle||n.inDesc||n.inSection||n.inContents)&&n}}const search=new FastSearch({searchInput:document.getElementById("search-input"),resultsContainer:document.getElementById("search-results"),json:`/chirpy-starter/zh-cn/index.json`})</script></div><aside aria-label="Scroll to Top"><button id=back-to-top type=button class="btn btn-lg btn-box-shadow">
<i class="fas fa-angle-up"></i></button></aside></div><div id=mask class="d-none position-fixed w-100 h-100 z-1"></div></body></html>