1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/content/github/working-with-github-pages/adding-content-to-your-github-pages-site-using-jekyll.md
Vanessa Yuen 3df90fc9b8 Hello git history spelunker!
Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
2020-09-27 14:10:11 +02:00

4.3 KiB

title, intro, product, redirect_from, versions
title intro product redirect_from versions
Adding content to your GitHub Pages site using Jekyll You can add a new page or post to your Jekyll site on {{ site.data.variables.product.prodname_pages }}. {{ site.data.reusables.gated-features.pages }}
/articles/adding-content-to-your-github-pages-site-using-jekyll
free-pro-team enterprise-server
* *

People with write permissions for a repository can add content to a {{ site.data.variables.product.prodname_pages }} site using Jekyll.

About content in Jekyll sites

Before you can add content to a Jekyll site on {{ site.data.variables.product.prodname_pages }}, you must create a Jekyll site. For more information, see "Creating a {{ site.data.variables.product.prodname_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 {{ site.data.variables.product.prodname_pages }} and Jekyll."

{{ site.data.reusables.pages.about-front-matter }}

{{ site.data.reusables.pages.test-locally }}

Adding a new page to your site

{{ site.data.reusables.pages.navigate-site-repo }} {{ site.data.reusables.pages.navigate-publishing-source }} 3. 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. 4. 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 at https://octocat.github.io/about/contact.

layout: page
title: "<em>PAGE TITLE</em>"
permalink: /<em>URL-PATH</em>/
  1. Below the frontmatter, add content for your page. {{ site.data.reusables.files.write_commit_message }} {{ site.data.reusables.files.choose-commit-email }} {{ site.data.reusables.files.choose_commit_branch }} {{ site.data.reusables.files.propose_file_change }}

Adding a new post to your site

{{ site.data.reusables.pages.navigate-site-repo }} {{ site.data.reusables.pages.navigate-publishing-source }} 3. Navigate to the _posts directory. 4. 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. 4. 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: "<em>POST TITLE</em>"
date: </em>YYYY-MM-DD hh:mm:ss -0000</em>
categories: <em>CATEGORY-1</em> <em>CATEGORY-2</em>
  1. Below the frontmatter, add content for your post. {{ site.data.reusables.files.write_commit_message }} {{ site.data.reusables.files.choose-commit-email }} {{ site.data.reusables.files.choose_commit_branch }} {{ site.data.reusables.files.propose_file_change }}

Next steps

{{ site.data.reusables.pages.add-jekyll-theme }} For more information, see "Adding a theme to your {{ site.data.variables.product.prodname_pages }} site using Jekyll."