Adding content to your GitHub Pages site using Jekyll
You can add a new page or post to your Jekyll site on GitHub Pages.
GitHub Pages は、GitHub Free のパブリックリポジトリ、GitHub Pro のパブリックおよびプライベートリポジトリ、GitHub Team、GitHub Enterprise Cloud、GitHub Enterprise Server で利用いただけます。
People with write permissions for a repository can add content to a GitHub Pages site using Jekyll.
ここには以下の内容があります:
About content in Jekyll sites
Before you can add content to a Jekyll site on GitHub Pages, you must create a Jekyll site. For more information, see "Creating a GitHub Pages site with Jekyll."
The main types of content for Jekyll sites are pages and posts. A page is for standalone content that isn't associated with a specific date, such as an "About" page. The default Jekyll site contains a file called about.md
, which renders as a page on your site at YOUR-SITE-URL/about
. You can edit the contents of that file to personalize your "About" page, and you can use the "About" page as a template to create new pages. For more information, see "Pages" in the Jekyll documentation.
A post is a blog post. The default Jekyll site contains a directory named _posts
that contains a default post file. You can edit the contents of that post, and you can use the default post as a template to create new posts. For more information, see "Posts" in the Jekyll documentation.
Your theme includes default layouts, includes, and stylesheets that will automatically be applied to new pages and posts on your site, but you can override any of these defaults. For more information, see "About GitHub Pages and Jekyll."
To set variables and metadata, such as a title and layout, for a page or post on your site, you can add YAML front matter to the top of any Markdown or HTML file. For more information, see "Front Matter" in the Jekyll documentation.
Changes to your site are published automatically when the changes are merged into your site's publishing source. If you want to preview your changes first, you can make the changes locally instead of on GitHub Enterprise. Then, test your site locally. For more information, see "Testing your GitHub Pages site locally with Jekyll."
Adding a new page to your site
-
On GitHub Enterprise, navigate to your site's repository.
-
Navigate to the publishing source for your site. For more information about publishing sources, see "About GitHub Pages."
-
In the root of your publishing source, create a new file for your page called PAGE-NAME.md, replacing PAGE-NAME with a meaningful filename for the page.
-
Add the following YAML frontmatter to the top of the file, replacing PAGE TITLE with the page's title and URL-PATH with a path you want for the page's URL. For example, if the base URL of your site is
https://octocat.github.io
and your URL-PATH is/about/contact/
, your page will be located athttps://octocat.github.io/about/contact
.layout: page title: "PAGE TITLE" permalink: /URL-PATH/
-
Below the frontmatter, add content for your page.
-
ページの下部で、ファイルに行った変更について述べた短く意味のあるコミットメッセージを入力してください。コミットメッセージ内でコミットを複数の作者に関連付けることができます。詳細は「複数の共同作者を持つコミットを作成する」を参照してください。
-
コミットメッセージフィールドの下で、コミットを現在のブランチに追加するか、新しいブランチを作成するかを判断してください。現在のブランチが
master
なら、コミットに新しいブランチを作成することにして、プルリクエストを作成してください。 -
[Propose file change] をクリックします。
Adding a new post to your site
-
On GitHub Enterprise, navigate to your site's repository.
-
Navigate to the publishing source for your site. For more information about publishing sources, see "About GitHub Pages."
-
Navigate to the
_posts
directory. -
Create a new file called YYYY-MM-DD-NAME-OF-POST.md, replacing YYYY-MM-DD with the date of your post and NAME-OF-POST with the name of your post.
-
Add the following YAML frontmatter to the top of the file, replacing POST TITLE with the post's title, YYYY-MM-DD hh:mm:ss -0000 with the date and time for the post, and CATEGORY-1 and CATEGORY-2 with as many categories you want for your post.
layout: page title: "POST TITLE" date: YYYY-MM-DD hh:mm:ss -0000categories: CATEGORY-1 CATEGORY-2
-
Below the frontmatter, add content for your post.
-
ページの下部で、ファイルに行った変更について述べた短く意味のあるコミットメッセージを入力してください。コミットメッセージ内でコミットを複数の作者に関連付けることができます。詳細は「複数の共同作者を持つコミットを作成する」を参照してください。
-
コミットメッセージフィールドの下で、コミットを現在のブランチに追加するか、新しいブランチを作成するかを判断してください。現在のブランチが
master
なら、コミットに新しいブランチを作成することにして、プルリクエストを作成してください。 -
[Propose file change] をクリックします。
次のステップ
You can add a Jekyll theme to your GitHub Pages site to customize the look and feel of your site. For more information, see "Adding a theme to your GitHub Pages site using Jekyll."