From 0a869e2e767c166da321dbcbb8e64c42b95e07a4 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Wed, 9 Aug 2017 11:37:42 -0500 Subject: [PATCH] rename .Rmd to .Rmarkdown and add the build script --- README.md | 4 ++-- exampleSite/R/build.R | 6 +++++ exampleSite/config.toml | 2 +- exampleSite/content/_index.Rmarkdown | 24 +++++++++++++++++++ .../content/{_index.md => _index.markdown} | 4 ++-- 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 exampleSite/R/build.R create mode 100644 exampleSite/content/_index.Rmarkdown rename exampleSite/content/{_index.md => _index.markdown} (97%) diff --git a/README.md b/README.md index 83ea056..0dd8a3d 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,10 @@ find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xarg 0 ./layouts/partials/foot_custom.html 9 ./layouts/partials/footer.html 0 ./layouts/partials/head_custom.html - 19 ./layouts/partials/header.html + 20 ./layouts/partials/header.html 7 ./static/css/fonts.css 50 ./static/css/style.css - 136 total + 137 total ``` I can certainly further reduce the code, for example, by eliminating the CSS, but I believe a tiny bit CSS can greatly improve readability. You cannot really find many CSS frameworks that only contain 50 lines of code. diff --git a/exampleSite/R/build.R b/exampleSite/R/build.R new file mode 100644 index 0000000..4747bd1 --- /dev/null +++ b/exampleSite/R/build.R @@ -0,0 +1,6 @@ +file.copy('content/_index.markdown', '../README.md', overwrite = TRUE) +system("sed -i '' -e '1,6d' -e '34,38d' ../README.md") +cat( + '[![Screenshot](https://github.com/yihui/hugo-xmin/raw/master/images/screenshot.png)](https://xmin.yihui.name)\n', + file = '../README.md', append = TRUE +) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 534c96d..8441c44 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -4,7 +4,7 @@ title = "A minimal Hugo website" theme = "hugo-xmin" googleAnalytics = "" disqusShortname = "" -ignoreFiles = ["\\.Rmd$", "_files$", "_cache$"] +ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"] preserveTaxonomyNames = true footnotereturnlinkcontents = "↩" diff --git a/exampleSite/content/_index.Rmarkdown b/exampleSite/content/_index.Rmarkdown new file mode 100644 index 0000000..4f58bee --- /dev/null +++ b/exampleSite/content/_index.Rmarkdown @@ -0,0 +1,24 @@ +--- +title: Home +--- + +[Github repo](https://github.com/yihui/hugo-xmin) + +# HUGO XMIN + +## _Keep it simple, but not simpler_ + +**XMin** is a Hugo theme written by [Yihui Xie](https://yihui.name) in about four hours: half an hour was spent on the Hugo templates, and 3.5 hours were spent on styling. The main motivation for writing this theme was to provide a really minimal example to beginners of Hugo templates. This XMin theme contains about 130 lines of code in total, including the code in HTML templates and CSS (also counting empty lines). + +```{bash, comment='', echo=2} +cd ../..; +find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xargs wc -l +``` + +I can certainly further reduce the code, for example, by eliminating the CSS, but I believe a tiny bit CSS can greatly improve readability. You cannot really find many CSS frameworks that only contain 50 lines of code. + +Although it is a minimal theme, it is actually fully functional. It supports pages (including the home page), blog posts, a navigation menu, categories, tags, and RSS. With [a little bit customization](https://github.com/yihui/hugo-xmin/blob/master/exampleSite/layouts/partials/foot_custom.html), it can easily support LaTeX math expressions, e.g., + +`$${\sqrt {n}}\left(\left({\frac {1}{n}}\sum _{i=1}^{n}X_{i}\right)-\mu \right)\ {\xrightarrow {d}}\ N\left(0,\sigma ^{2}\right)$$` + +All pages not under the root directory of the website are listed below. You can also visit the list page of a single section, e.g., [posts](/post/), or [notes](/note/). See the [About](/about/) page for the usage of this theme. diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.markdown similarity index 97% rename from exampleSite/content/_index.md rename to exampleSite/content/_index.markdown index 3ba31b2..df0a22b 100644 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.markdown @@ -23,10 +23,10 @@ find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xarg 0 ./layouts/partials/foot_custom.html 9 ./layouts/partials/footer.html 0 ./layouts/partials/head_custom.html - 19 ./layouts/partials/header.html + 20 ./layouts/partials/header.html 7 ./static/css/fonts.css 50 ./static/css/style.css - 136 total + 137 total ``` I can certainly further reduce the code, for example, by eliminating the CSS, but I believe a tiny bit CSS can greatly improve readability. You cannot really find many CSS frameworks that only contain 50 lines of code.