Code Monkey home page Code Monkey logo

hugo-xmin's Introduction

HUGO XMIN

Keep it simple, but not simpler

XMin is a Hugo theme written by Yihui Xie 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 140 lines of code in total, including the code in HTML templates and CSS (also counting empty lines).

find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xargs wc -l
       5 ./layouts/404.html
      12 ./layouts/_default/single.html
      20 ./layouts/_default/list.html
      13 ./layouts/_default/terms.html
       0 ./layouts/partials/foot_custom.html
       0 ./layouts/partials/head_custom.html
       9 ./layouts/partials/footer.html
      20 ./layouts/partials/header.html
      51 ./static/css/style.css
       7 ./static/css/fonts.css
     137 total

I can certainly further reduce the code, for example, by eliminating the CSS, but I believe a tiny bit of CSS can greatly improve readability. You cannot really find many CSS frameworks that only contain 50 lines of code.

Screenshot

hugo-xmin's People

Contributors

andry-tino avatar deining avatar fallenstedt avatar justinclift avatar kcarnold avatar oneleaftea avatar shimmy1996 avatar tmward avatar uebayasi avatar yihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hugo-xmin's Issues

Unable to get syntax highlighting to work

I followed the method mentioned in the pull request for syntax highlighting using hightlight.js, however I'm unable to get it to work.

layouts/partials/foot_custom.html:

<script src="//yihui.name/js/math-code.js"></script>
<script async src="//mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>

<script async src="//yihui.name/js/center-img.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/languages/r.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/languages/python.min.js"></script>

<script>
hljs.configure({languages: []});
hljs.initHighlightingOnLoad();
</script>

layouts/partials/head_custom.html:

<link href="https;//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/styles/gruvbox-dark.min.css" rel="stylesheet">

static/css/fonts.css:

/* code */
pre {
  border: 1px solid #3A3E41;
  /* box-shadow: 5px 5px 5px #000; */
  background: #f8f8f8;
  padding: 1em;
  overflow-x: auto;
}
code { background: #181A1B; }
pre code { background: none; }

Post without specified date shows "0001-01-01".

As can be seen on the demo page, a post without specified date frontmatter still shows "0001-01-01" as its date.
This is reproducable using this theme and a simple post under hugo 0.36.1:

---
title: Demo
---
This post does not specify date.

It seems that date now has a default value of 0 instead of nil. This can be checked using {{ printf "%#v" .Params.date }}.

标签&logo问题

  1. 想给标签做个说明^[类似WordPress那种],怎么做?
  2. logo怎么加上?

category and tag folder names all lower cased, resulting in "file not found"

Hi Yihui,

I followed your protocol to generate a new site using blogdown::new_site( theme = "yihui/hugo-xmin" ), which produces the website in the "Viewer" pane. However, I encountered the following problem: when I navigate to "Categories -> Example", there is an error

Not found:
./categories/Example

I identified the source of the problem: it was because the folder names under public/categories/ are all lower-cased, even though some of the category names in the YAML header has their first letter capitalized. Since I don't fully understand how hugo generates the pages with lists of posts, I don't know how I can solve this problem.

Thanks!
Bin

Update for Hugo 0.55.2

Hugo 0.55 deprecates preserveTaxonomyNames . How can I update the theme to make it compatible to this new version?

could not format html files

I covert wordpress xml to md file with your tools "oldblog_xml", then I use blogdown to format html files, but can't format html files.

The MD file look like this,

author: sam
comments: true
date: 2015-04-29 15:56:59+00:00
layout: post
link: http://hugo.qinqianshan.com/wordpress-display-page-plugins-pagenavi/
slug: wordpress-display-page-plugins-pagenavi
title: Wordpress显示分页--插件Pagenavi
wordpress_id: 14
categories:

  • Wordpress
    tags:
  • Pagenavi
  • wordpress
  • 显示分页

If I remove " layout" and "slug" ,it will format html files. Because I have 400 md files, if I remove "layout" and "slug" one by one ,it will take long time . Do you have any suggestions to solve this ?

error building theme

I'm having issues building this theme any help would be appreciated! thank you!

:> hugo serve
Building sites … ERROR 2019/09/19 21:30:28 Error while rendering "taxonomyTerm" in "": template: _default/terms.html:8:21: executing "_default/terms.html" at <.Page.RelPermalink>: can't evaluate field Page in type hugolib.WeightedPages

The generated sitemap.xml has errors

Here's what Google Search Console says:

This is not a valid URL. Please correct it and resubmit.
Examples
URL:
/tags/checkwriter/
Line 5
Parent tag:
url
Tag:
loc
URL:
/post/2023/07/21/online-check-writing/
Line 8
Parent tag:
url
Tag:
loc
URL:
/
Line 11
Parent tag:
url
Tag:
loc

create a post in .rmd format

screen shot 2018-03-25 at 12 24 25 pm

Hi Yihui, Thank you very much for creating the xmin theme. I am using it to create my personal website. As a newbie, I wasn't sure how to create a new post. I tried the addin in RStudio to create a .md format post, committed, and then pushed it to the github. The post in .md format has been successfully published on my website. However, when I used the same way to try to create a new post in .rmd format, it can't be shown on my website. I wonder if there are any other steps for creating a post in .rmd format? or we can only create a post in .md format? Thank you very much for your help!

Keren

inline footnotes no longer working

I've been using xmin for my blogdown theme since 2018. I recently updated the theme files because the 2019 version was no longer deploying the netlify correctly, but now my inline footnotes no longer work.

Here is an example page and you can see "^[]" in the text instead of footnotes.

So, I decided to test inline footnote functionality by generating a new xmin site and testing off of that. (I.e., all I did was make a new Rproj and then run blogdown::new_site(theme = "yihui/hugo-xmin")). Inline footnotes do not work when testing. See below screencap.
inline

However, regular footnotes do. See below screencap.
regular

Is there a way to get inline footnotes working again with xmin? Thanks for your help!

Strange behavior of `build.R` under `R` directory

I found the script "build.R" will always create a README.md at the parent directory of my blog site project. I think it is because of the destination directory is used as ../README.md, and in many conditions the working directory is the project root directory. So that command will then creat a README.md file at the parent directory of the project root directory, which is not intended.

file.copy('content/_index.markdown', '../README.md', overwrite = TRUE)
if (Sys.which('sed') != '') 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
)

HTML not working?

I've been using the xmin template for ~6 months now. I just went on my website and noticed that the html formatting seemed to not be rendering properly. When I servesite() in Rstudio, it renders correctly and looks great. I am able to push and deploy without any errors, but the website doesn't look like the serve site.

This is what it should look like:
image

And this is what it looks like when deployed:
image

Any idea what's wrong? I don't have an error code so I'm not sure how to even begin googling this.

Display tags in the post

Is it possible to display tags assigned to the post when we read the post, with minimal code writing?

Thanks!

How do I remove or limit the post list on the homepage

The homepage of an xmin Hugo site contains a list of all posts under all pages. I have some old posts that I don't want to display on the homepage, I was wondering if it was possible to...

  1. Limit what pages it includes posts from? (e.g. only include posts from "posts" and exclude "notes".)
  2. Limit how long the list is? (probably the easiest?)
  3. Remove it altogether?

I would want this to only affect the homepage's list and not to touch the pages own lists.

Thanks! :)

Building error on Windows

Seemingly this theme does not support Windows OS?

The following is the error information:

Rendering content/_index.Rmarkdown
running: bash  -c "cd ../..;
find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xargs wc -l"
Quitting from lines 14-16 (_index.Rmarkdown) 
Error in engine(options) :       14 ./bookdown-demo/style.css
     127 ./bookdown-demo/toc.css
     224 ./bookdown-demo/_book/applications.html
     218 ./bookdown-demo/_book/final-words.html
     227 ./bookdown-demo/_book/index.html
     396 ./bookdown-demo/_book/intro.html
      99 ./bookdown-demo/_book/libs/gitbook-2.6.7/css/plugin-bookdown.css
     291 ./bookdown-demo/_book/libs/gitbook-2.6.7/css/plugin-fontsettings.css
     426 ./bookdown-demo/_book/libs/gitbook-2.6.7/css/plugin-highlight.css
      28 ./bookdown-demo/_book/libs/gitbook-2.6.7/css/plugin-search.css
      10 ./bookdown-demo/_book/libs/gitbook-2.6.7/css/style.css
     218 ./bookdown-demo/_book/literature.html
     218 ./bookdown-demo/_book/methods.html
       0 ./bookdown-demo/_book/placeholder.html
     225 ./bookdown-demo/_book/references.html
      14 ./bookdown-demo/_book/style.css
      42 ./brain_network_viz/docs/config.html
      49 ./brain_network_viz/docs/edge.html
      58 ./brain_network_viz/docs/edge_renderer.html
      51 ./
Calls: local ... process_group.block -> call_block -> block_exec -> in_dir -> engine
此外: Warning message:
运行命令'"bash"  -c "cd ../..;
find . -not -path '*/exampleSite/*' \( -name '*.html' -o -name '*.css' \) | xargs wc -l"'的状态是123 
停止执行
Error in render_page(f) : Failed to render 'content/_index.Rmarkdown'
In addition: Warning message:
running command '"C:/PROGRA~1/MICROS~1/ROPEN~1/R-3.4.3/bin/x64/Rscript" "C:/Users/zlgsa/Documents/R/win-library/3.4/blogdown/scripts/render_page.R" "content/_index.Rmarkdown" "E:/git/test"' had status 1 
[1] TRUE

SessionInfo:

R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RevoUtils_10.0.7     RevoUtilsMath_10.0.1

loaded via a namespace (and not attached):
 [1] bookdown_0.6    Rcpp_0.12.15    later_0.6       digest_0.6.14   rprojroot_1.3-2 backports_1.1.2
 [7] magrittr_1.5    evaluate_0.10.1 blogdown_0.5    stringi_1.1.6   rmarkdown_1.8.5 tools_3.4.3    
[13] stringr_1.2.0   xfun_0.1        yaml_2.1.16     compiler_3.4.3  htmltools_0.3.6 knitr_1.18

Where to put a favicon?

I've tried putting a favicon in:

  1. The root directory
  2. A subdirectory of root called "static"
  3. The static subdirectory within themes

The favicon doesn't display in any of these cases.

Double quotes showing

Hello.
By default hugo convert double quotes from " to . On html code (&ldquo &rdquo).
How can I use default double and single quotes without converting?

where is the config.toml file

Dear Xie
I read the blogdown book I read the recent updates on https://www.r-bloggers.com/2021/01/announcing-blogdown-v1-0/ and congratulations and thank you!
I was going to try out your theme Xmin (latest version), but I cannot find the config.toml file, not even in the ExampleSite directory. I thought you recommended using the config.toml instead of config.yaml, is that recommendation not applicable anymore?
Sorry if this is a silly question. Thank you so much for your receptivity and your excellent work.

EDIT: Ok converted the YAML file into TOML using this site https://www.convertsimple.com/convert-yaml-to-toml/ and carefully reading. Thank you silly problem is solved.

search box

Any suggestions for how to add a search box to the theme?

Customizing the tags page

Specifically what files should I override to create my custom list and single tag pages?

I tried many alternatives, but I wasn't able to customize the single tag page at all.

how to add subcategories

I like your hugo-xmin theme very much . I have many categories and some subcategories, how to add subcategories ?

Images on landing page no longer rendering?

Hi all,

Not sure if anyone else has experienced this, but the standard Github logo of the original site build no longer seems to render. Yet it still renders on the xmin example site. I have not made any changes to the content folder. Not the end of the world, but couldn't figure it out after poking around for a bit - any suggestions?

Missing color definitions

It looks like the global background- and foreground-color is undefined. Hyperlinks have a background-color but no foreground-color.

screenshot_2019-02-08t02 03 07

Jump to next post

Yihui, can you give me some tips on modifying your theme? I'd like to put a link in the footer of each blog post that jumps to the next/previous blog post.

single.html can not render

single.html can not render success by

<p class="terms">
  {{ range $i := (slice "categories" "tags") }}
  {{ with ($.Param $i) }}
  {{ $i | title }}: 
  {{ range $k := . }}
  <a href='{{ relURL (print "/" $i "/" $k | urlize) }}'>{{$k}}</a> 
  {{ end }}
  {{ end }}
  {{ end }}
</p>

format

error message:

Building sites … ERROR 2018/02/07 17:03:32 Error while rendering "page" in "note/": template: theme/_default/single.html:10:17: executing "theme/_default/single.html" at <.>: range can't iterate over HTML

How to enable multilingual mode?

I'm trying to open a bilingual blog recently. And please forgive my stupid request if you think it's against the minimal idea of this theme.

Wrong figure caption

I tried to use .Rmd to generate figures with captions using R code chunks.

Following lines are used

```{r load data and visualization, message=FALSE, warning=FALSE, fig.cap=c("Matrix plot of all variables", "Linear trend of different groups")}
library(tidyverse)
birthsmoke <- read.table("https://onlinecourses.science.psu.edu/stat501/sites/onlinecourses.science.psu.edu.stat501/files/data/birthsmokers.txt", header = TRUE)
plot(birthsmoke)
ggplot(birthsmoke, aes(Gest, Wgt, color = Smoke)) +
  geom_point(shape = 1) +
  geom_smooth(method = "glm", se = FALSE) +
  theme_minimal()
```

But unfortunately, the result is not intended (following screenshot). Is it possible to support caption more properly?

image

静态托管问题

image
在修改了code颜色之后,本地访问是OK的,但是将生成的public文件夹中的静态页面托管到COS上进行访问出现下面的问题
image
这是HUgo本身问题,还是我托管静态页面的问题,或者主题的问题。
而且在修改了code颜色之后,在某个当前页面是生效的,其他页面是不能生效的

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.