Skip to content

Commit 50d7160

Browse files
authored
Merge pull request #10 from vsoch/add/preview
testing preview
2 parents 539f1e8 + 8ce51b1 commit 50d7160

File tree

8 files changed

+133
-20
lines changed

8 files changed

+133
-20
lines changed

.circleci/circle_urls.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
REPO_ID=$(curl https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME} | jq --raw-output '.id')
2+
echo "Repo ID is ${REPO_ID}"
3+
BASEURL=https://${CIRCLE_BUILD_NUM}-${REPO_ID}-gh.circle-artifacts.com/0/${CIRCLE_PROJECT_REPONAME}
4+
sed -i "26 s,.*,baseurl: $BASEURL,g" "_config.yml"

.circleci/config.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
version: 2.1
2+
3+
workflows:
4+
version: 2
5+
6+
# The build workflow will build a preview for the site, intended for PRs
7+
build:
8+
jobs:
9+
- build-site:
10+
filters:
11+
branches:
12+
ignore: docs
13+
14+
build_jekyll: &build_jekyll
15+
name: Jekyll Build
16+
command: |
17+
echo "Building RSE Blog for Preview"
18+
cp ~/repo/.circleci/circle_urls.sh ~/repo/circle_urls.sh
19+
cd ~/repo
20+
chmod u+x circle_urls.sh
21+
bash circle_urls.sh
22+
bundle exec jekyll build
23+
24+
jobs:
25+
build-site:
26+
docker:
27+
- image: circleci/ruby:2.4.1
28+
working_directory: ~/repo
29+
environment:
30+
- JEKYLL_ENV: production
31+
- NOKOGIRI_USE_SYSTEM_LIBRARIES: true
32+
- BUNDLE_PATH: ~/repo/vendor/bundle
33+
steps:
34+
- checkout
35+
- restore_cache:
36+
keys:
37+
- rubygems-v1
38+
- run:
39+
name: Bundle Install
40+
command: |
41+
cd ~/repo
42+
bundle check || bundle install
43+
- save_cache:
44+
key: rubygems-v1
45+
paths:
46+
- vendor/bundle
47+
- run: *build_jekyll
48+
- store_artifacts:
49+
path: ~/repo/_site
50+
destination: mkdocs-jekyll

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# MkDocs Jekyll Theme
22

3+
[![CircleCI](https://circleci.com/gh/vsoch/mkdocs-jekyll/tree/master.svg?style=svg)](https://circleci.com/gh/vsoch/mkdocs-jekyll/tree/master)
4+
35
This is a starter template for a mkdocs jekyll theme, based on these two
46
previous arts:
57

_config.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ description: > # this means to ignore newlines until "baseurl:"
2121
Write an awesome description for your new site here. You can edit this
2222
line in _config.yml. It will appear in your document head meta (for
2323
Google search results) and in your feed.xml site description.
24+
25+
# DO NOT CHANGE THE LINE OF THIS FILE without editing .circleci/circle_urls.sh
2426
baseurl: "/mkdocs-jekyll" # the subpath of your site, e.g. /blog
25-
url: "http://example.com" # the base hostname & protocol for your site
27+
28+
# This is mostly for testing
29+
url: "" # the base hostname & protocol for your site
2630

2731
# Social (First three Required)
2832
repo: "https://github.com/vsoch/mkdocs-jekyll"
@@ -34,9 +38,9 @@ twitter: vsoch
3438
linkedin: vsochat
3539
dockerhub: vanessa
3640

37-
# Image and (square) dimension for logo
38-
# logo: "/assets/img/logo/SRCC-square-white.png"
39-
logo: "/assets/img/logo/SRCC-square-red.png"
41+
# Image and (square) dimension for logo (don't start with /)
42+
# logo: "assets/img/logo/SRCC-square-white.png"
43+
logo: "assets/img/logo/SRCC-square-red.png"
4044
logo_pixels: 34
4145

4246
# Build settings
@@ -52,7 +56,7 @@ fixedNav: 'true' # true or false
5256

5357
permalink: /:year/:title/
5458
markdown: kramdown
55-
exclude: [_site, CHANGELOG.md, LICENSE, README.md]
59+
exclude: [_site, CHANGELOG.md, LICENSE, README.md, vendor]
5660

5761
# Collections
5862
collections:

_data/toc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- title: "Getting Started"
2-
url: "/docs/getting-started"
2+
url: "docs/getting-started"
33
- title: "About"
4-
url: "/about"
4+
url: "about"
55
- title: "News"
6-
url: "/news"
6+
url: "news"

_layouts/post.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
---
44

55
<h1 style="margin-bottom:0px">{{ page.title }}</h1>
6+
{% if page.badges %}{% for badge in page.badges %}<span class="badge badge-{{ badge.type }}">{{ badge.tag }}</span>{% endfor %}{% endif %}
67
<span class="post-date" style="font-style: italic;">{{ page.date | date: "%B %d, %Y" }}</span>
78
{{ content }}

docs/getting-started.md

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ want to link to docs, the url is the path starting with the docs folder.
116116

117117
```yaml
118118
- title: "Getting Started"
119-
url: "/docs/getting-started/"
119+
url: "docs/getting-started/"
120120
- title: "About"
121-
url: "/about"
121+
url: "about"
122122
- title: "News"
123-
url: "/news"
123+
url: "news"
124124
```
125125
126126
### News Posts
@@ -132,6 +132,33 @@ folder that will parse into the site [feed]({{ site.baseurl }}/feed.xml)
132132
The bottom of the page links the user to a post archive, where posts are organized
133133
according to the year.
134134

135+
### Badges
136+
137+
For news post items, it's nice to be able to tag it with something that indicates
138+
a status, such as "warning" or "alert." For this reason, you can add badges to
139+
the front end matter of any post page, and they will render colored by a type,
140+
with the tag of your choice. For example, here is an example header for
141+
a post:
142+
143+
```yaml
144+
---
145+
title: "Two Thousand Nineteen"
146+
date: 2019-06-28 18:52:21
147+
categories: jekyll update
148+
badges:
149+
- type: warning
150+
tag: warning-badge
151+
- type: danger
152+
tag: danger-badge
153+
---
154+
```
155+
156+
And here is the post preview with the rendered badges that it produces:
157+
158+
![BADGES](https://user-images.githubusercontent.com/814322/60386723-02281100-9a67-11e9-8226-b967445f9941.png)
159+
160+
A second post with the other types is also shown.)
161+
135162
### Alerts
136163

137164
{% include alert.html type="info" title="What is an alert?" content="An alert is a box that can stand out to indicate important information. You can choose from levels success, warning, danger, info, and primary. This example is an info box, and the code for it looks like this:" %}
@@ -227,7 +254,37 @@ jekyll serve
227254
bundle exec jekyll serve
228255
```
229256

230-
You can then move on to customization.
257+
258+
### Preview
259+
260+
We provide a [CircleCI](https://circleci.com/) configuration recipe that you
261+
can use to preview your site on CircleCI before merging into master. You
262+
should follow the instructions to [set up a project](https://circleci.com/docs/enterprise/quick-start/),
263+
and then in the project settings be sure to enable building forked build requests,
264+
and to cancel redundant builds. The preview will be built on CircleCI, and saved
265+
to static files for you to browse. The only change you will need is to edit
266+
the static files location to be the name of your respository, which is at te
267+
bottom of the `.circleci/config.yml` file:
268+
269+
```yaml
270+
- store_artifacts:
271+
path: ~/repo/_site
272+
destination: mkdocs-jekyll
273+
```
274+
275+
In the above, the destination should coincide with your repository name.
276+
Remember that for most links, CircleCI won't honor an `index.html` file in a subfolder
277+
(e.g., `subfolder/index.html` will not be served as `subfolder/`, so for example,
278+
you might need to turn this:
279+
280+
```
281+
https://<circleci>/0/mkdocs-jekyll/docs/getting-started/
282+
```
283+
into this:
284+
285+
```
286+
https://<circleci>/0/mkdocs-jekyll/docs/getting-started/index.html
287+
```
231288

232289
## Customization
233290

pages/index.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,8 @@ guide for a complete summary. Briefly:
3434
- *Navigation*: Control over the main navigation on the left of the page, and automatic generation of table of contents for each page on the right.
3535
- *News* A posts feed for news and updates, along with an archive (organized by year).
3636
- *Templates* or specifically, "includes" that make it easy to create an alert, documentation link, or other content.
37-
38-
39-
## Under Development
40-
41-
Soon we will also have:
42-
4337
- *Continuous Integration* recipes to preview the site
44-
- *Testing* for any broken links
4538

46-
For features, getting started with development, see the {% include doc.html name="Getting Started" path="getting-started" %} page.
39+
40+
For features, getting started with development, see the {% include doc.html name="Getting Started" path="getting-started" %} page. Would you like to request a feature or contribute?
41+
[Open an issue]({{ site.repo }}/issues)

0 commit comments

Comments
 (0)