lektor-website/content/docs/deployment/ghpages/contents.lr

62 lines
2.0 KiB
Plaintext
Raw Normal View History

2015-12-19 14:52:17 +01:00
title: GitHub Pages
---
summary: Deploys to github pages.
---
body:
* `ghpages://username/repository`
* `ghpages+https://username/repository`
A popular way to host websites for Open Source projects is the GitHub pages.
It's a free services provided by [GitHub :ext](http://github.com/) which allows
to host completely static websites through GitHub.
The way this is implemented in Lektor currently is that Lektor will force-push
a website into a repository of choice. There are two ways to push it up:
`ghpages` (which uses SSH) or `ghpages+https` (which uses HTTPS). The latter
can also accept `username:password@` in the URL to hold the credentials in
addition to accepting username and password from the command line.
Example:
```ini
[servers.production]
target = ghpages://your-user/your-repository
```
## Behavior
The way this deployment support works is that it commits a new commit into a
temporary location and pushes it into the `gh-pages` or `master` branch
depending on the name of the repository. If you push to `username.github.io`
then it commits to `master`, otherwise to `gh-pages`. This is consistent
with behavior for GitHub Pages.
## CNAME Support
If you want to use a [CNAME :ext](https://en.wikipedia.org/wiki/CNAME) with
GitHub pages and Lektor you can provide the intended CNAME with the `?cname`
parameter:
```ini
[servers.production]
target = ghpages://your-user/your-repository?cname=www.example.com
```
For more information about how CNAMEs work with GitHub you can read about
the feature in the GitHub help center:
[Adding a CNAME file to your repository
:ext](https://help.github.com/articles/adding-a-cname-file-to-your-repository/).
## 404 Pages
Per convenention the file named `404.html` is used as placeholder if a page
cannot be found. You can create such a page by creating a `404.html/contents.lr`
file.
## Automatic Deployments
If you want to use ghpages it's desirable to have this build automatically.
This is easy to accomplish with the help of Travis-CI. For more information
see [Deploying with Travis-CI :ref](../travisci/).