README.md 3.84 KB
Newer Older
CodeDuSoir's avatar
CodeDuSoir committed
1
![Build Status](https://gitlab.com/opendatahub/opendatahub.io/badges/master/build.svg)
GitLab's avatar
GitLab committed
2
3
4
5
![Jekyll Version](https://img.shields.io/gem/v/jekyll.svg)

---

CodeDuSoir's avatar
CodeDuSoir committed
6
# OpenDataHub.io Website
GitLab's avatar
GitLab committed
7

CodeDuSoir's avatar
CodeDuSoir committed
8
## Creating an Inline Announcement
GitLab's avatar
GitLab committed
9

CodeDuSoir's avatar
CodeDuSoir committed
10
All announcements are located in the `_posts` directory.  They are written in Markdown (`.md`). Files should be named `YYYY-MM-DD-unique-title`.
GitLab's avatar
GitLab committed
11

CodeDuSoir's avatar
CodeDuSoir committed
12
Announcements will display all content on the news page.  Unlike blog posts, be sure to omit `layout` and `preview` fields.
GitLab's avatar
GitLab committed
13
14


CodeDuSoir's avatar
CodeDuSoir committed
15
16
17
18
19
20
21
```jekyll
---
author: yourusername
title:  Sample Announcement
date: 2018-09-09
categories: announcement
---
GitLab's avatar
GitLab committed
22

CodeDuSoir's avatar
CodeDuSoir committed
23
24
Content goes here and will be shown directly on the news list.
```
GitLab's avatar
GitLab committed
25

CodeDuSoir's avatar
CodeDuSoir committed
26
## Creating a Blog Post
GitLab's avatar
GitLab committed
27

CodeDuSoir's avatar
CodeDuSoir committed
28
All blog posts are located in the `/_posts` directory. Each file is a Markdown (`.md`) file, just like announcements.  Files should be named `YYYY-MM-DD-unique-title`.
GitLab's avatar
GitLab committed
29

CodeDuSoir's avatar
CodeDuSoir committed
30
Instead of showing all content on the news list, they will have a preview field which is shown.  Content will be shown on the blog post detail page.  The `preview` page is required or else the entire content of the blog post will be displayed on the news list.  The `layout` is required to display properly when clicked.
GitLab's avatar
GitLab committed
31

CodeDuSoir's avatar
CodeDuSoir committed
32
33
34
35
36
37
38
39
40
41
```jekyll
---
layout: blog
author: yourusername
title:  Sample Blog Post
preview: Preview text is required.  It is shown on the news list instead of the full content.
date: 2018-09-10
categories: blog
---
# Content goes here
GitLab's avatar
GitLab committed
42

CodeDuSoir's avatar
CodeDuSoir committed
43
This content is NOT shown on the news list, but will be shown on the detail page.  To reach the detail page, the user will click on the "Read more..." link which is automatically generated.
GitLab's avatar
GitLab committed
44

CodeDuSoir's avatar
CodeDuSoir committed
45
## More stuff...
GitLab's avatar
GitLab committed
46
47
48

```

CodeDuSoir's avatar
CodeDuSoir committed
49
## Create a Page
GitLab's avatar
GitLab committed
50

CodeDuSoir's avatar
CodeDuSoir committed
51
To keep things organized, pages are located in the `pages` directory, with a directory structure mirroring the site. Configure the metadata:
GitLab's avatar
GitLab committed
52

CodeDuSoir's avatar
CodeDuSoir committed
53
54
55
56
57
58
59
```jekyll
---
layout: default
title: My Page
permalink: /my-page/
---
```
GitLab's avatar
GitLab committed
60

CodeDuSoir's avatar
CodeDuSoir committed
61
If you add a new page and want it to appear in the sidebar of that section (such as the sidebar under **Docs**), then you also need to update the `yaml` file associated with that group. These are located under `_data/`. For **Docs**, you would update `docs_toc.yml`, following the structure that currently exists within that file.
GitLab's avatar
GitLab committed
62
63


CodeDuSoir's avatar
CodeDuSoir committed
64
## Links
GitLab's avatar
GitLab committed
65

CodeDuSoir's avatar
CodeDuSoir committed
66
Links should prepend `site.baseurl` before the location. e.g.:
GitLab's avatar
GitLab committed
67

CodeDuSoir's avatar
CodeDuSoir committed
68
69
70
71
72
```jekyll
<link href="{{ '/assets/css/home.css' | prepend: site.baseurl }}" rel="stylesheet">
<img src="{{ '/assets/img/datahub_logo_black.png' | prepend: site.baseurl }}">
<a class="nav-link" href="{{ '/news/' | prepend: site.baseurl }}">NEWS</a>
```
GitLab's avatar
GitLab committed
73

CodeDuSoir's avatar
CodeDuSoir committed
74
## Local testing
GitLab's avatar
GitLab committed
75

CodeDuSoir's avatar
CodeDuSoir committed
76
You can run the site just like any other Jekyll site as [documented](https://jekyllrb.com/docs/) or using a [jekyll container](https://store.docker.com/community/images/jekyll/jekyll).
GitLab's avatar
GitLab committed
77

CodeDuSoir's avatar
CodeDuSoir committed
78
79
80
### Running a jekyll container on linux using docker
You can view the local changes to your clone of the opendatahub.io in realtime by running the jekyll server in a docker container. You'll be running the container with a volume mounted to the root of your opendatahub.io repository.
From the root of your cloned opendatahub.io repository:
GitLab's avatar
GitLab committed
81

CodeDuSoir's avatar
CodeDuSoir committed
82
83
84
```bash
# To prevent SELinux from denying docker from mounting your repository folder as a volume You'll need to change the selinux context for the root of the opendatahub.io repository directory
chcon -Rt svirt_sandbox_file_t $PWD
GitLab's avatar
GitLab committed
85

CodeDuSoir's avatar
CodeDuSoir committed
86
87
# Set an environment variable for the version of the jekyll container
export JEKYLL_VERSION=3.8
GitLab's avatar
GitLab committed
88

CodeDuSoir's avatar
CodeDuSoir committed
89
90
91
# Run the jekyll container, map the container port 4000 to the host port 4000 and set the environment variable JEKYLL_UID to your user ID to prevent any permission issues with adding or modifying files
# If you're concerned about the container user running with the same user ID, you can modify the permission of the repo folder to allow read/write access to other
docker run --rm --volume="/home/llasmith/projects/data-hub/opendatahub.io:/srv/jekyll" -it -p 4000:4000 -e JEKYLL_UID=$(id -u) jekyll/jekyll:$JEKYLL_VERSION jekyll serve
GitLab's avatar
GitLab committed
92

CodeDuSoir's avatar
CodeDuSoir committed
93
```