forked from wrj2009/wrj2009.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.json
1 lines (1 loc) · 7.11 KB
/
search.json
1
[{"title":"GitHub Pages 使用方法","url":"/2021/06/08/GitHubPages%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/","content":"GitHub 上有很多人使用 GitHub Pages 服务搭建了自己的网站。比如你现在打开的就是使用 GitHub Pages 服务搭建的。(doge)那么,GitHub Pages 该如何使用呢? \n注意这篇教程只是根据个人经验并参考了一些其他文章写成的,难免会存在一些错误,如果发现错误欢迎在评论区指正。 \n正文创建仓库GitHub Pages 是存储在 GitHub 仓库里的。因此首先要创建一个仓库。点击 GitHub 右上角的“+”,选择“New Repository”,进入创建仓库页面。然后为仓库命名。要使用 GitHub Pages,必须将仓库命名为“username.github.io”(username 表示你的 GitHub 用户名)。例如,我的用户名是 wrj2009,我就需要创建一个名为“wrj2009.github.io”的仓库。 \n在主分支上添加文件创建完成后,就可以添加文件了。可以在主分支上添加一个 index.html 文件,这样访问创建的网站时就不会显示 404 了。HTML 的使用方法这里就不展开讲了。这一步只是为了方便确认 GitHub Pages 有没有创建成功。 \n设置 GitHub Pages创建了 index.html 后,转到 Settings 标签,在设置页面的左边会有一个 Pages 选项。点击它进入 Github Pages 的设置页面。然后,在“Source”下面,把“Branch”设为刚才你添加 index.html 的分支,并把右边的文件夹图标的下拉框设为“/(root)”。\n确认是否创建成功以上步骤全部完成后,就可以在浏览器里打开你的网站了!网站的地址与仓库名是一样的,也就是“username.github.io”。如果打不开,可能需要刷新或者清理缓存(这个方法只是个人经验)。确认能够打开后,就可以在你的仓库中添加更多的页面了! \n一些提示\n最好在每个文件夹下都创建一个 index.html,这样可以避免在访问“https://xxx.github.io/xxx/”而不是“https://xxx.github.io/xxx/xxxxx.html”时出现 404。 \n添加一个 404.html 就可以自定义 404 页面了! \n\n\n以后会写 Hexo 的使用教程,敬请期待(鬼知道我写得好不好)(doge)\n","tags":["教程"]},{"title":"Hexo 使用方法","url":"/2021/06/09/Hexo%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95/","content":"很多人都有自己的博客,在很多编程有关的网站上都有博客这项功能。这篇教程将介绍使用 GitHub Pages 服务搭建自己的博客的方法。\n注意这篇教程只是根据个人经验并参考了一些其他文章写成的,难免会存在一些错误,如果发现错误欢迎在评论区指正。另外,这篇教程是根据在 Windows 下使用 Hexo 的方法写的,在其他系统中可能不适用。 \n正文创建 GitHub Pages见 GitHub Pages 使用方法。 \n安装和配置必要的程序Git 或 Git (Git for Windows)Node.js部分系统中可以直接使用命令来安装。 \n配置 Git安装 Git 后,可以找到一个叫作 Git Bash 的程序。打开它,然后输入以下内容:git config --global user.name "username"git config --global user.email "email"把 username 替换成你在 GitHub 的用户名,把 email 替换成你在 GitHub 的电子邮箱地址。接下来创建 SSH,在 Git Bash 中输入以下内容:ssh-keygen -t rsa -C "email"把 email 替换成你在 GitHub 的电子邮箱地址。 \n\n注意这一步必须在 Git Bash 中执行。 \n\n完成这一步后,能够在 Git Bash 的输出中找到 SSH 的路径。打开其中的“id_rsa.pub”文件(Windows 可以用记事本),复制其中的内容。然后,打开 GitHub 设置中的新建 SSH 密钥页面,把刚才复制的内容粘贴到“Key”一栏中。(标题似乎可以随便填) \n安装 Hexo首先在 Git Bash 或命令提示符中打开一个用于存放博客数据的目录,然后输入以下内容:npm install -g hexo-clihexo init blog你可以把 blog 替换为你想要的名字。然后,在 Git Bash 或命令提示符中进入与这个名字同名的目录,再输入以下内容:npm install\n配置博客现在,可以在生成的文件夹中找到一个名为“_config.yml”的文件。打开它,翻到最下面,填上相应内容。deploy: type: git repo: https://github.com/username/username.github.io branch: main把 repo 对应的内容中的所有 username 替换为你在 GitHub 上的用户名。把 branch 对应的内容改为你的 GitHub Pages 分支。更改后,保存这个文件,然后在 Git Bash 或命令提示符中输入:npm install hexo-deployer-git --save这样,在部署的时候就不会发生错误了。在 _config.yml 中还有非常多的配置,可以根据 Hexo 文档 中的说明进行调整。 \n更换主题在 Hexo 中有非常多的主题可以选,默认的 Landscape 只是其中之一。你可以在Hexo 主题 中挑选。有良心的主题作者一定都会写主题的文档的(doge),所以这儿就不详细写怎么配置主题了。不过有一点要提醒一下,选择主题时,图片的链接和蓝色字的链接大部分都是不同的。\n创建文章Hexo 的所有文章都存储在 source 文件夹中的 _post 中。为了方便创建,在 Git Bash 或命令提示符中打开博客的根目录,然后输入以下命令即可创建文章:hexo new "title"把 title 替换为文章的标题。接下来,在 source/_post 下,就可以找到刚才创建的文章。打开它,然后使用 Markdown 或 HTML 写文章就可以了。 \n生成页面并部署 GitHub Pages每次更新或添加文章后,可以依次执行下面 3 个命令:hexo cleanhexo generatehexo deploy当然如果你比较懒,可以输入以下 3 个:hexo clhexo ghexo d现在,打开你的网站(xxx.github.io),就能看到你的博客了! \n\nHexo 使用教程就写到这儿,实际上 Hexo 还可以添加很多功能,这种功能在很多主题的文档中都有所提及,所以(因为我懒)就不继续写 Hexo 的更多玩法了。 \n更多功能之一——LaTeX(其实是用 MathJax 的)!$\\frac{1}{2} + \\frac{1}{2} = 1$\n","tags":["教程"]},{"title":"Hello World","url":"/2021/01/17/hello-world/","content":"Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.\nQuick StartCreate a new post$ hexo new "My New Post"\nMore info: Writing\nRun server$ hexo server\nMore info: Server\nGenerate static files$ hexo generate\nMore info: Generating\nDeploy to remote sites$ hexo deploy\nMore info: Deployment\n\n\n\n以上是原文\n\n\n\n 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n 9\n 10\n 11\n 12\n 13\n 14\n 15\n 16\n 17\n 18\n 19\n 20\n 21\n 22\n 23\n 24\n 25\n 26\n 27\n 28\n 29\n 30\n\n\n 1\n 2\n 3\n 4\n 5\n 6\n 7\n 8\n 9\n 10\n 11\n 12\n 13\n 14\n 15\n 16\n 17\n 18\n 19\n 20\n 21\n 22\n 23\n 24\n 25\n 26\n 27\n 28\n 29\n 30\n"}]