Code Monkey home page Code Monkey logo

hugo-theme-nostyleplease's Introduction

no style, please!

A (nearly) no-CSS, fast, minimalist Hugo theme ported from riggraz/no-style-please.

Features

  • Fast (1kb of CSS!)
  • Light, dark and auto modes
  • Responsive
  • Content first (typography optimized for maximum readability)
  • RSS feed (using Hugo's embedded RSS template)
  • MathJax support

Installation

The easiest way is to clone this repo (or add as a submodule) to themes/nostyleplease then append theme = 'nostyleplease' as a newline to config.toml. Pages shipped with theme as examples have draft: true in their frontmatters, use --buildDrafts to build them.

Usage

You can edit config.toml file to customize your blog. You can change things such as the name of the blog, the author, the appearance of the theme (light, dark or auto), how dates are formatted, etc. Customizable fields should be straightforward to understand. Still, config.toml contains some comments to help you understand what each field does. Note that the config.toml under root directory of your hugo site will completely override the one in the theme directory, so copy the attributes you want to keep or edit from the theme's config.toml to your site's config.toml.

Customize the menu

In order to add/edit/delete entries from the main menu, you have to edit the menu.toml file inside data folder. Through that file you can define the structure of the menu. Take a look at the default configuration to get an idea of how it works and read on for a more comprehensive explanation.

The menu.toml file accepts the following fields:

  • entries define a new unordered list that will contain menu entries
  • each entry is a member of the TOML array entries in question
  • each entry can have the following attributes:
    • title, which defines the text to render for this menu entry (NB: you can also specify HTML!)
    • url, which can be used to specify an URL for this entry. If not specified, title will be rendered as-is; otherwise title will be sorrounded by a link tag pointing to the specified URL. Note that the URL can either be relative or absolute. Also note that you can get the same result by placing an <a> tag in the title field.
    • post_list, which can be set either to true or to an object. If it is true, the entry will have a list of all posts as subentries. This is used to render your post list. If you want to customize which posts to render (e.g. by section), you can add one or more of the following attributes under post_list:
      • section, which can be set to a string. It is used to render a list of posts of the specified section only. If you don't set it, then posts of all sections will be rendered.
      • limit, which can be set to a number. It specifies the number of posts to show. If not set, all posts will be rendered.
      • show_more, which can be true. If it is true and if the number of posts to show is greater than the specified limit, render a link to another page. To specify the URL and the text of the link, you can set show_more_url and show_more_text attributes, which are documented below.
      • show_more_url, which can be a string. It specifies the URL for the show more link. Use only if show_more is true. This will usually redirect to a page containing all posts, which you can easily create using an section page (see section pages section)
      • show_more_text, which can be a string. It specifies the text for the show more link. Use only if show_more is true.
    • entries, yes, you can have entries inside entries. In this way you can create nested sublists!

Section pages

A so-called section page is a page that shows a list of posts in a specific section. It should be automatically created by hugo when a new section is created.

Customize the index page

The index.md page should use layout home, which is the layout that displays the menu. If you want to have some content after the menu, you can just add that content in the _index.md file, and it will automatically show under the menu.

Another thing you can do to customize the index page is show the description of your blog between the title and the menu. To do this, just edit config.toml and change params.theme_config.show_description to true.

Adding table of contents

You can add a table of contents by supplying the toc: true param to your post front matter. If you want a border around it you can also set tocBorder: true. The toc style behavior is handled by Goldmark and the defaults can be found in the config.toml file.

Pro tips

Dark mode for images

This theme provides dark mode by inverting all colors of light mode throught the CSS invert() function. This approach would also invert the color of all images, but, since this is not the behaviour one would expect, images are not inverted by default.

However, if you would like to force the color inversion on a specific image you can do so by applying class="ioda" to that image ("ioda" stands for "invert on dark appearance"). See the image in the overview post for an example of this approach. Note that color inversion will take place only when the theme has dark appearance!

For example, if you have a black and white image it could make sense to invert it in dark mode. On the other hand, a colorful image will probably look bad if inverted.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Masellum/hugo-theme-nostyleplease.

Thanks

Some of the code comes from wooseopkim/hugo-theme-nostyleplease, a fork of this theme.

Some of the test pages are from this jekyll theme.

License

The theme is available as open source under the terms of the MIT License.

hugo-theme-nostyleplease's People

Contributors

cbhyphen avatar drupaldoesnotexists avatar dtujmer avatar underscorehao 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

hugo-theme-nostyleplease's Issues

changing the font

hey, first I just wanted to thank you for porting over this theme!

Is there any procedure in place to change the font? I'm inexperienced with frontend development, so the few attempts I made all failed.

Once I find a solution, I'd also be happy to create a PR to extend the documentation on how to do this.

nostyleplease list of suggestions

Hi, thank you for this fantastic fork I have question but I also have some suggestions for changes that I have implemented on my site locally.

My suggestions to improve theme:

1. Border around table of content. It's set in css to "black". I moved in css ".toc" to theme switcher and changed color to link color. If you create your own color-theme it will be useful. Also in dark theme it will look better.

  .toc {
    border: thin solid $--link-color;
    padding: 1rem;
  }

2. I done the same with color of highlight (it appears after clicking in link in table of content). To do that I added more colors in color schemes.

@mixin theme($--bg-color, $--primary-text-color, $--secondary-text-color, $--link-color, $--visited-link-color, $--highlight) {
  *:target {
    background: $--highlight;
    color: $--primary-text-color;
   }
@mixin dark-appearance {
  @include theme(#212121, #fafafa, #000000, #0071bc, #a359e9, #FFFF00);
}
@mixin light-appearance {
  @include theme(#ffffff, #212121, #666666, #1e70bf, #921292, #FFFF00);
}
@mixin retro-appearance {
  @include theme(#000a1a, #c4ffc6, #161616, #c0ff00, #c0ff00, #007A35);
}

3. As you can see I added "retro" appearance. :) Maybe worth to be added.

And I have question about this theme.

4. I want to publish posts in categories (for example "technology" and "diy"). How edit menu.toml to show a list from one category?

5. I dont understand this part of README.

The index.md page should use layout home, which is the layout that displays the menu. If you want to have some content after the menu, you can just add that content in the _index.md file, and it will automatically show under the menu.
Another thing you can do to customize the index page is show the description of your blog between the title and the menu. To do this, just edit config.toml and change params.theme_config.show_description to true.

If I edit _index.md - text appear between title and menu - not under. Second - in which file I should put description? I dont have index.md file.

[Help] How to reference an html file WITHOUT making it go straight to content

Hello,

Super newb in every way. I can easily add files into my blog content automatically, however I am trying to reference an html file on the site that is not included on the content/posts/blog list.

I tried doing:

[[entries]]

title = "Recommendations"

url = "[insert full file path here]"
But when I click the link, it puts me to a 404.

I know that it’s not impossible within the theme because I have seen other websites using the theme do it (ex. https://riggraz.dev/, notice how the link to the newsletter is its own static page without being listed on posts).

Thanks!

highlight 默认类型

如果没有默认类型 后面没有备注语法语言的话就会变成黑的 非常难看

Installation instruction

Thank you for designing such a brilliant theme, however I have some difficulties in installing the theme.
Can you detail the installation instruction?
I'm new to hugo and didn't know so much.

Italics

For some reason, *italics* in the markdown file are not rendered properly. _Now this_ is rendered as underlined. I'm using Hugo version 0.92.

corrected Table of Contents instructions

In the README, the developer says:

You can add a table of contents by supplying the toc: true param to your post front matter. If you want a border around it you can also set tocBorder: true.

The correct params would actually be toc = true and tocBorder = true.

[Help]: Button to toggle dark mode

Hello,

I was wondering if there's any way to add this feature of adding a button to toggle dark mode/light mode.
I understand that this might not be in the interest of everyone, but I would appreciate any pointers on how to do the same.

Thanks

Error with "hugo server": unclosed action

Issue happens when trying to run Hugo server with default config and only theme installed in "layouts/partials/menu_item.html" at line 16.

Error: add site dependencies: load resources: loading templates: "/home/my-user/hugosite/themes/nostylesplease/layouts/partials/menu_item.html:16:1": parse failed: template: partials/menu_item.html:16: unclosed action

Version: Hugo Static Site Generator v0.68.3/extended linux/amd64 BuildDate: 2020-03-25T06:15:45Z
Possible solution: remove new lines in this part

{{ partial "post_list.html" (dict 
                "context" .
                "section" $item.post_list.section
                "limit" $item.post_list.limit
                "show_more" $item.post_list.show_more
                "show_more_text" $item.post_list.show_more_text
                "show_more_url" $item.post_list.show_more_url
                ) -}}```

Please add demo

Would be great to have instant access to a demo website to know if this theme fits user needs :) Tell me if I can help

Syntax Highlighting

First I want to say thanks for the great theme! I must've tried at least 10 before finally stopping on this one! Much appreciated!

My only issue is that syntax highlighting doesn't really work as expected. I had a look through the code and if I use the default rrt from your example config.toml all is well, but trying other themes (I used the codes from here - https://xyproto.github.io/splash/docs/all.html) has unintended results. In the css file there are entries for code and pre tags, but I was under the impression that when noClasses = true then Hugo will handle the highlighting?

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.