about summary refs log tree commit diff stats
path: root/themes/xmin/exampleSite/content/about.md
diff options
context:
space:
mode:
authorAlan Pearce2020-01-10 19:55:06 +0100
committerAlan Pearce2020-01-10 19:55:06 +0100
commiteea42a5b1b05fbbdc9f33df41576de0232fcbd4d (patch)
tree942ce4381278d49870b4016784ea2bfdfc1d66b6 /themes/xmin/exampleSite/content/about.md
parentd93409097b7a4d68c5660446bfb574ac673040a5 (diff)
parent7befbf2f991e217aa4d52615f9f430cae30897f5 (diff)
downloadwebsite-eea42a5b1b05fbbdc9f33df41576de0232fcbd4d.tar.xz
website-eea42a5b1b05fbbdc9f33df41576de0232fcbd4d.zip
Merge commit '7befbf2f991e217aa4d52615f9f430cae30897f5' as 'themes/xmin'
Diffstat (limited to 'themes/xmin/exampleSite/content/about.md')
-rw-r--r--themes/xmin/exampleSite/content/about.md101
1 files changed, 101 insertions, 0 deletions
diff --git a/themes/xmin/exampleSite/content/about.md b/themes/xmin/exampleSite/content/about.md new file mode 100644 index 0000000..dd83942 --- /dev/null +++ b/themes/xmin/exampleSite/content/about.md
@@ -0,0 +1,101 @@
1---
2title: About Hugo XMin
3author: Yihui Xie
4---
5
6**XMin** is the first Hugo theme I have designed. The original reason that I wrote it was I needed a minimal example of Hugo themes when I was writing the [**blogdown**](https://github.com/rstudio/blogdown) book. Basically I wanted a simple theme that supports a navigation menu, a home page, other single pages, lists of pages, blog posts, categories, tags, and RSS. That is all. Nothing fancy. In terms of CSS and JavaScript, I really want to keep them minimal. In fact, this theme does not contain any JavaScript code at all, although on this example website I did introduce some JavaScript code (still relatively simple anyway). The theme does not contain any images, either, and is pretty much a plain-text theme.
7
8The theme name "XMin" can be interpreted as "**X**ie's **Min**imal theme" (Xie is my last name) or "e**X**tremely **Min**imal theme".
9
10# config.toml
11
12For this example site, I defined permalinks for two sections, `post` and `note`, so that the links to pages under these directories will contain the date info, e.g., `https://xmin.yihui.name/post/2016/02/14/a-plain-markdown-post/`. This is optional, and it is up to your personal taste of URLs.
13
14```
15[permalinks]
16 post = "/post/:year/:month/:day/:slug/"
17 note = "/note/:year/:month/:day/:slug/"
18```
19
20You can define the menu through `menu.main`, e.g.,
21
22```
23[[menu.main]]
24 name = "Home"
25 url = "/"
26 weight = 1
27[[menu.main]]
28 name = "About"
29 url = "/about/"
30 weight = 2
31[[menu.main]]
32 name = "Categories"
33 url = "/categories/"
34 weight = 3
35[[menu.main]]
36 name = "Tags"
37 url = "/tags/"
38 weight = 4
39[[menu.main]]
40 name = "Subscribe"
41 url = "/index.xml"
42```
43
44Alternatively, you can add `menu: main` to the YAML metadata of any of your pages, so that these pages will appear in the menu.
45
46The page footer can be defined in `.Params.footer`, and the text is treated as Markdown, e.g.,
47
48```
49[params]
50 footer = "© [Yihui Xie](https://yihui.name) 2017"
51```
52
53# Custom layouts
54
55There are two layout files under `layouts/partials/` that you may want to override: `head_custom.html` and `foot_custom.html`. This is how you inject arbitrary HTML code to the head and foot areas. For example, this site has a file `layouts/partials/foot_custom.html` to support LaTeX math via MathJax and center images automatically:
56
57```html
58<script src="//yihui.name/js/math-code.js"></script>
59<script async src="//cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
60</script>
61
62<script async src="//yihui.name/js/center-img.js"></script>
63```
64
65You can certainly enable highlight.js for syntax highlighting by yourself through `head_custom.html` and `foot_custom.html` if you want.
66
67If you do not like the default fonts (e.g., `Palatino`), you may provide your own `static/css/fonts.css` under the root directory of your website to override the `fonts.css` in the theme.
68
69# Other features
70
71I could have added more features to this theme, but I decided not to, since I have no intention to make this theme feature-rich. However, I will teach you how. I have prepared several examples via pull requests at https://github.com/yihui/hugo-xmin/pulls, so that you can see the implementations of these features when you check out the diffs in the pull requests. For example, you can:
72
73- [Enable Google Analytics](https://github.com/yihui/hugo-xmin/pull/3)
74
75- [Enable Disqus comments](https://github.com/yihui/hugo-xmin/pull/4)
76
77- [Enable highlight.js for syntax highlighting of code blocks](https://github.com/yihui/hugo-xmin/pull/5)
78
79- [Display categories and tags on a page](https://github.com/yihui/hugo-xmin/pull/2)
80
81- [Add a table of contents](https://github.com/yihui/hugo-xmin/pull/7)
82
83- [Add a link in the footer of each page to "Edit this page" on Github](https://github.com/yihui/hugo-xmin/pull/6)
84
85To fully understand these examples, you have to read [the section on Hugo templates](https://bookdown.org/yihui/blogdown/templates.html) in the **blogdown** book.
86
87# Design philosophy
88
89Lastly, a few words about my design philosophy for this theme: I have been relying on existing frameworks like Bootstrap for years since I'm not really a designer, and I was always scared by the complexity of CSS.
90
91When I started writing this theme, I asked myself, "_What if I just write from scratch?_" No Bootstrap. No Normalize.css. I don't care about IE (life could be so much easier without IE) or inconsistencies among browsers (for personal websites). As long as the theme looks okay in Chrome, Firefox, and Safari, I'm done. Thanks to the simplicity of Markdown, you cannot really produce very complicated HTML, and I think styling the HTML output from Markdown is much simpler than general HTML documents. For example, I do not need to care much about form elements like textareas or buttons.
92
93After I finished this theme, I started to wonder why I'd need `normalize.css` at all (it sounds like a religious belief). The default appearance of modern browsers actually looks pretty good in my eyes, after I tweak the typeface a little bit.
94
95Compared to inconsistencies across browsers, I care much more about these properties of HTML elements:
96
97- Tables should always be centered, and striped tables are easier to read especially when they are wide. Tables should not have vertical borders.
98- An image should be centered if it is the only child element of a paragraph.
99- The `max-width` of images, videos, and iframes should be `100%`.
100
101I hope you can enjoy this theme. The source code is [on Github](https://github.com/yihui/hugo-xmin). Happy hacking!