Github Pages 使用教程

## 一、创建 Pages


  • 1. 访问网站 https://github.com,注册账号后点击右上角的头像按钮,选择 Create new,在弹出菜单中点击 New repository。

    [upl-image-preview url=https://s.sx.sd/2024-12-18/1734517159-241116-screenshot-2024-12-18-18-18-31-25-df198e732186825c8df26e3c5a10d7cd.jpg]
  • 2. 在创建仓库的页面中点击输入框,输入 `账户名.github.io` ([color=red]必须是这个,不然页面不生效[/color]),输入完成后点 Create repository。
    [upl-image-preview url=https://s.sx.sd/2024-12-18/1734517502-199135-screenshot-2024-12-18-18-23-13-89-df198e732186825c8df26e3c5a10d7cd.jpg]
  • 3. 创建好后,点击 `…`,选择 Create new file。
    [upl-image-preview url=https://s.sx.sd/2024-12-18/1734517882-700917-screenshot-2024-12-18-18-29-49-93-df198e732186825c8df26e3c5a10d7cd.jpg]
  • 4. 来到编辑器页面后,你就可以写 HTML 代码了!😚
    [upl-image-preview url=https://s.sx.sd/2024-12-18/1734517882-773997-screenshot-2024-12-18-18-30-33-29-df198e732186825c8df26e3c5a10d7cd.jpg]
  • 5. 输入完后,在 New your file 输入框里填写 `index.html`(它会把这个文件名当成网站首页),然后点击 Commit changes,再点 Commit changes,就可以了
  • 6. 等待三十秒,然后访问 `账户名.github.io` 即可!

  • ___

    ## 二、添加额外页面

    一个静态网站不单单只有一个页面,所以我们需要添加其他页面。
    [color=blue][u]这里介绍两种方法:[/u][/color]

  • - 无分类添加页面
  • - 有分类添加页面
  • ### 无分类添加页面

  • 1. 首先,点击 `…`,选择 Create new file。
    [upl-image-preview url=https://s.sx.sd/2024-12-18/1734517882-700917-screenshot-2024-12-18-18-29-49-93-df198e732186825c8df26e3c5a10d7cd.jpg]
  • 2. 然后输入你想添加的页面英文名,结尾 .html,例如:`support.html` `ikun.html` `contact.html`。
  • 3. 输入代码,保存。
  • 4. 然后访问 地址/xxx 即可。
  • ### 有分类添加页面

  • 1. 首先,点击 `…`,选择 Create new file。
    [upl-image-preview url=https://s.sx.sd/2024-12-18/1734517882-700917-screenshot-2024-12-18-18-29-49-93-df198e732186825c8df26e3c5a10d7cd.jpg]
  • 2. 然后先输入文件夹名,格式:`文件夹名/页面英文名.html`,例如:`img/support.html` `jinitaimei/ikun.html` `qq/contact.html`。
  • 3. 输入代码,保存。
  • 4. 然后访问 地址/文件夹名/xxx 即可。

  • ___

    ## 三、Cloudflare Pages 托管 Github Pages

  • 1. 前往 [https://pages.cloudflare.com/](https://dash.cloudflare.com/sign-up/workers-and-pages),注册账户。
  • 2. 授权 Github,跟据提示操作即可。