mirror of https://gitlab.com/curben/blog
Update installation guide
Suggest to run 'hexo server' for website preview.
This commit is contained in:
parent
dde0a696bb
commit
ae4cf09d64
|
@ -79,7 +79,7 @@ The following are the major changes I made from the upstream.
|
|||
- Homepage shows index of posts.
|
||||
- Remove header and footer display (except for `/about` page).
|
||||
- Use the latest version of [jQuery](https://jquery.com/download/), [fancyBox](https://github.com/fancyapps/fancyBox/releases) and [Font Awesome](https://github.com/FortAwesome/Font-Awesome/releases)
|
||||
- All js and css files are self-hosted.
|
||||
- All js and css files are self-hosted and [pre-compressed](https://docs.gitlab.com/ee/user/project/pages/introduction.html#serving-compressed-assets).
|
||||
- Remove analytic, comment system and donation links.
|
||||
|
||||
---
|
||||
|
|
|
@ -12,7 +12,6 @@ Create a website/blog (hosted by [GitLab](https://about.gitlab.com/features/page
|
|||
4. Change project website to a user website. This is so that the website's home page is `<your-username>.gitlab.io/`, instead of `<your-username>.gitlab.io/hexo`.
|
||||
Go to `Settings -> General -> Advanced -> Rename repository`. Change the Path to `<your-username>.gitlab.io`.
|
||||
5. If you just want to use a similar layout as this blog, or you're not planning to customize it, you don't have to [install](#installation) Hexo. You still need to change the blog's name and favicon though ([how-to](#naming).
|
||||
Having Hexo makes it easier for you to debug, rather than relying entirely on the GitLab runner.
|
||||
1. To create a new post (*without* using [Hexo](https://hexo.io/docs/writing)), create a new `<post-title>.md` in the [source/_posts](source/_posts) folder.
|
||||
2. Start with the following header/[front-matter](https://hexo.io/docs/front-matter):
|
||||
```
|
||||
|
@ -27,11 +26,12 @@ Create a website/blog (hosted by [GitLab](https://about.gitlab.com/features/page
|
|||
6. After you create a new post, the website would be available on `<your-username>.gitlab.io/` or the link shown on your project `Settings -> Pages`.
|
||||
|
||||
## Installation
|
||||
1. Clone this project to your workstation. Change `<folder>` to a preferred name.
|
||||
1. Having Hexo means you can debug locally, rather than waiting for gitlab runner. You can even run a local server to preview your blog (see step 6 below).
|
||||
2. Clone this project to your workstation. Change `<folder>` to a preferred name.
|
||||
```bash
|
||||
$ git clone https://gitlab.com/curben/curben.gitlab.io <folder>
|
||||
```
|
||||
2. Install Node.js.
|
||||
3. Install Node.js.
|
||||
```bash
|
||||
# Installing npm will also install nodejs as dependency.
|
||||
# Ubuntu/Debian
|
||||
|
@ -41,19 +41,24 @@ $ sudo yum install npm
|
|||
# Arch Linux
|
||||
$ sudo pacman -S npm
|
||||
```
|
||||
3. Install Hexo and its dependencies (defined in [package.json](package.json)).
|
||||
4. Install Hexo and its dependencies (defined in [package.json](package.json)).
|
||||
```bash
|
||||
$ sudo npm install -g hexo-cli
|
||||
$ cd <folder>
|
||||
$ npm install
|
||||
```
|
||||
4. Generate static files to check for any error. You should always do this before pushing/merging commits to the `master` branch.
|
||||
5. Generate static files to check for any error. You should always do this before pushing/merging commits to the `master` branch.
|
||||
```bash
|
||||
$ hexo generate
|
||||
```
|
||||
5. Commit the changes and push them. The generated `public` and `node_modules` are [ignored](.gitnore), as GitLab runner will generate them by itself.
|
||||
6. Check the build status by going to your project `CI /CD -> Pipelines`. Due to the limitation of `hexo`, the build will always pass even when error occurred. Check the Jobs log, look for any error in `$ hexo deploy`.
|
||||
7. If there is no error, the generated website would be available on `<your-username>.gitlab.io/` or the link shown on your project `Settings -> Pages`.
|
||||
6. (Optional) Start Hexo server on localhost:4000 to preview the blog. ([more info](https://hexo.io/docs/server))
|
||||
```bash
|
||||
$ npm install hexo-server --save
|
||||
$ hexo server
|
||||
```
|
||||
7. Commit the changes and push them. The generated `public` and `node_modules` are [ignored](.gitnore), as GitLab runner will generate them by itself.
|
||||
8. Check the build status by going to your project `CI /CD -> Pipelines`. Due to the limitation of `hexo`, the build will always pass even when error occurred. Check the Jobs log, look for any error in `$ hexo deploy`.
|
||||
9. If there is no error, the generated website would be available on `<your-username>.gitlab.io/` or the link shown on your project `Settings -> Pages`.
|
||||
|
||||
## Writing
|
||||
1. Create a new post (using Hexo)
|
||||
|
@ -113,5 +118,3 @@ If you don't have any plan to send merge requests to the upstream, you can remov
|
|||
## Useful links:
|
||||
[Hexo Docs](https://hexo.io/docs/)
|
||||
[GitLab Pages](https://docs.gitlab.com/ee/user/project/pages/index.html)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue