You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-4Lines changed: 57 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,54 @@
2
2
3
3
Delphi's homepage at https://cmu-delphi-main.netlify.app/
4
4
5
-
This site is based on [Hugo](https://gohugo.io).
5
+
This site is based on [Hugo](https://gohugo.io) and uses [Prettier](https://prettier.io) for formatting.
6
+
7
+
## Structure
8
+
9
+
The main content is in the `/content` directory written in Markdown or RMarkdown for blog posts.
10
+
In addition to the Markdown content frontmatter with YAML syntax is used at the beginning of the file to customize and describe the content. Common fields include `title` and `description`.
11
+
However, depending on the file it can have additional fields. For example for blog posts additional fields are used to list the authors, hero images, summaries, tags, and so on.
12
+
13
+
### Linking
14
+
15
+
Hugo uses so called shortcodes for embedding logic into Markdown files. A good example is linking to other pages.
16
+
17
+
A relative reference to another page can be created using the `relref` shortcode. The argument is the filename with an optional `#` anchor to jump to a specific section.
18
+
19
+
**Examples**
20
+
21
+
```
22
+
national daily survey]({{< relref "surveys">}})
23
+
[syndromic COVID-19 indicator based on doctor visits]({{< relref "2020-10-14-dv-signal" >}})
Instead of a direct link to the API reference there is the `apiref` shortcode. The advantage is that it is easy to later change the API base URL without changing each appearance. The argument is the path segment to point to.
28
+
29
+
**Examples**
30
+
31
+
```
32
+
[public API]({{< apiref "api/covidcast.html" >}})
33
+
[Epidata API]({{< apiref "/" >}})
34
+
```
35
+
36
+
In RMarkdown things are slightly more different since the R Markdown parser is used before Hugo takes over. Blogdown has a special function for handling shortcodes: `blogdown::shortcode_html`.
In addition, there in the `/data` directory there are the following listings in YAML syntax
50
+
51
+
-`authors.yaml` list of blog authors referenced in the `authors` field in blog posts. This list is used to generated the author information at the end of a blog post
52
+
-`supporters.yaml` list of supporters/collaborators
6
53
7
54
## Development Environment
8
55
@@ -13,8 +60,9 @@ This site is based on [Hugo](https://gohugo.io).
13
60
14
61
#### Commands
15
62
16
-
1. run `npm start` to create a development Hugo server
17
-
1. run `npm build` to build a minified build in `/public`
63
+
1. run `npm start` to create a development Hugo server running at http://localhost:1313
64
+
1. run `npm run format` to run prettier and format files
65
+
1. run `npm run build` to build a minified build in `/public`
18
66
19
67
### Blog Editor
20
68
@@ -38,10 +86,15 @@ In order to convert the Rmd files to HTML files for Hugo you also need to:
38
86
-`local=TRUE` similar to `-D` to process draft files
39
87
-`run_hugo=FALSE` to manually run hugo
40
88
-`build_rmd=TRUE` force a (re)build of the Rmd pages
89
+
1. Alternatively, run `npm run build:blog`
41
90
1. Run Hugo server as usual
42
91
43
-
blogdown also has an integrated server `blogdown::serve_site()` which will render RMarkdown files on the fly and does a similar thing as `hugo server -D`
92
+
blogdown also has an integrated server `blogdown::serve_site()` which will render RMarkdown files on the fly and does a similar thing as `hugo server -D`.
93
+
A shortcut is available through `npm run start:blog`.
44
94
45
95
#### Adding a new blog post
46
96
47
97
In case you use new dependencies don't forget to either edit `environment.yml` or `dependencies.R`.
98
+
A Github action should runs when Rmd files changes so it will verify that the blog post can be built.
99
+
However, the converted HTML file along with all generated images are committed to the repository.
100
+
This simplifies the deployment and ensures that we have a blog post even when the API or data changes.
0 commit comments