Skip to content

Instantly share code, notes, and snippets.

@makyo
Created June 25, 2017 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makyo/2b28f7ff573c7ced5b24b3a9b87f59a4 to your computer and use it in GitHub Desktop.
Save makyo/2b28f7ff573c7ced5b24b3a9b87f59a4 to your computer and use it in GitHub Desktop.
Getting started with GH Pages

It's pretty easy to get started with GitHub pages. They let you host whatever you want in terms of a static site. They host SALSA, Post Self, writing.drab-makyo.com, drab-makyo.com, etc.

Setting up domain

A domain points to an IP address that knows how to serve up the files. It does this by using a DNS (domain name server) record. These have to be hosted by some limited sites, including Namecheap.

  1. In Namecheap, from your dashboard, click Manage next to your domain
  2. At the top of the record, click Advanced DNS
  3. Under Host Records, click Add Record
  4. Enter the following:
  • Type: A record
  • Host: @
  • Value: 192.30.252.153 (This is GitHub's domain; it'll know how to serve your page)
  • TTL: leave as Automatic
  1. Click the green check to add, then repeat the same, except under Value, put 192.30.252.154 - another GitHub domain in case the first gets overloaded

Setting up GitHub

GitHub can host any static site. This means just HTML files, or a generated site such as that produced by Jekyll, which powers the sites above. I'll show it for Jekyll here, and then show how to do Jekyll

  1. Log into GitHub

  2. At the top of the page, click the + with the drop-down arrow next to it, then click New Repository (basically a folder that will host your site)

  3. Under Name, type whatever, so long as it doesn't have spaces; a good idea would just be the URL of your site, lunostophiles.zone

  4. Tick the box labeled Initialize this repository with a README

  5. Click the green button at the bottom; you don't need to worry about the rest of the page

  6. At the top of the repository section on the next page, click the gear icon with Settings by it

  7. Scroll to the section labeled GitHub Pages and click Choose a Theme

  8. Pick a theme you like from the list, then click Select Theme

  9. Go back to the settings page as above and scroll down to GitHub Pages, then enter your URL (without http:// or a path or anything else), then save

  10. From the GitHub repository, you can add files you want, or upload files. Jekyll recognizes both HTML and Markdown files, going off of the file extension: md for markdown, and html for html

  11. If you just create a file, it will use the theme you chose. Alternatively, you can start the page with frontmatter which will allow it to be just a standalone html page:

    ---
    layout: page
    ---
    
  12. If you use the theme you chose, Jekyll will try to guess the title from the file name (e.g: my-page.md will lead to the title My Page. If you want something different, you can use the frontmatter:

    ---
    title: "Whatever you want"
    ---
    
  13. If you want to do blog posts, you can create files in the folder _posts. These must be named in the format YYYY-MM-DD-title.md (or .html). For the first one, you can name the file _posts/2017-06-25-whatever.md (with correct date and title, natch) and it will make the folder for you as you type

From here, we can talk about prose.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment