1/23/19 UPDATE:
Things have changed quite a bit (for the better) since my last answer. This updated answer will show you how to configure:
- Root apex (example.com)
- Sub-domain (www.example.com)
- HTTPS (optional but strongly encouraged)
In the end, all requests to example.com
will be re-directed to https://www.example.com (or http:// if you choose NOT to use HTTPS). I always use www
as my final landing. Why(1,2), is for another discussion.
This answer is long but it is not complicated. I was verbose for clarity as the GitHub docs on this topic are not clear or linear.
Step 1: Enable GitHub pages in GitHub settings
- From your repo, click on the tab
- Scroll down to the
GitHub Pages
section. You have two options:
- Choosing
master branch
will treat /README.md
as your web index.html
. Choosing master branch /docs folder
will treat /docs/README.md
as your web index.html
.
- Choose a theme.
- Wait a minute while GitHub publishes your site. Verify it works by clicking on the link next to
Your site is ready to be published at
Step 2: Specify custom domain in GitHub settings
Enter your custom domain name here and hit save
:
This is a subtle, but important step.
- If the custom domain you added to your GitHub Pages site is
example.com
, then www.example.com
will redirect to example.com
- If the custom domain you added to your GitHub Pages site is
www.example.com
, then example.com
will redirect to www.example.com
.
As mentioned before, I recommend always landing at www
so I entered www.example.com
as pictured above.
Step 3: Create DNS entries
In your DNS provider's web console, create four A
records and one CNAME
.
A
Records for @
(aka root apex):
Some DNS providers will have you specify @
, others (like AWS Route 53) you will leave the sub-domain blank to indicate @
. In either case, these are the A
records to create:
185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153
Check the Github docs to confirm these are the most up-to-date IPs.
- Create a
CNAME
record to point www.example.com to YOUR-GITHUB-USERNAME.github.io
.
This is the most confusing part.
Note the YOUR-GITHUB-USERNAME
NOT the GitHub repo name! The value of YOUR-GITHUB-USERNAME
is determined by this chart.
For a User pages site (most likely what you are), CNAME
entry will be username.github.io
, ex:
For a Organization pages site, CNAME
entry will be orgname.github.io
, ex:
Step 5: Confirm DNS entries
Confirm your A
records by running dig +noall +answer example.com
. It should return the four 185.x.x.x
IP addresses you entered.
Confirm your CNAME
record by running dig www.example.com +nostats +nocomments +nocmd
. It should return a CNAME YOUR-GITHUB-USERNAME.github.io
It may take an hour or so for these DNS entries to resolve/propagate. Once they do, open up your browser to http://example.com
and it should re-direct to http://www.example.com
Step 6: SSL (HTTPS) Configuration. Optional, but highly recommended
After you have the custom domain working, go back to the repo settings. If you already have the settings page open, hard refresh the page.
If there is a message under the Enforce HTTPS
checkbox, stating that it is still processing you will need to wait. You may also need to hit the save
button in the Custom domain
section to kick off the Enforce HTTPS
processing.
Once processing is completed, it should look like this:
Just click on the Enforce HTTPS
checkbox, and point your browser to https://example.com
. It should re-direct and open https://www.example.com
THATS IT!
GitHub will automatically keep your HTTPS cert up-to-date AND should handle the apex to www
redirect over HTTPS.
Hope this helps!!
When you're doing queries, you can use ancestor() to restrict the query to children of a particular entity - in your example, you could look for only descendants of B
, which you couldn't do if they were all at the top level.
There's more on Ancestor Queries in Programming Google App Engine
The Keys and Entity Groups doc also says that:
Entity group relationships tell App Engine to store several entities in the same part of the distributed network ... All entities in a group are stored in
the same datastore node
edit: The same document also lists some of the reasons why you don't want your entity groups to grow too large:
The more entity groups your
application has—that is, the more root
entities there are—the more
efficiently the datastore can
distribute the entity groups across
datastore nodes. Better distribution
improves the performance of creating
and updating data. Also, multiple
users attempting to update entities in
the same entity group at the same time
will cause some users to retry their
transactions, possibly causing some to
fail to commit changes. Do not put all
of the application's entities under
one root.
Any transaction on an entity in a Group will cause any other writes to the same entity group to fail. If you have a large entity group with lots of writes, this causes lots of contention, and your app then has to handle the expected write failures. Avoiding datastore contention goes into more detail on the strategies you can use to minimse the contention.
Best Answer
You can do it. Notice that all DNS CNAME entry point to the same host.
1: github.com/florianwolters/florianwolters.github.com
CNAME file content:
blog.florianwolters.de
DNS CNAME: blog > florianwolters.github.com
2: github.com/florianwolters/pear/tree/gh-pages
CNAME file content:
pear.florianwolters.de
DNS CNAME: pear > florianwolters.github.com