Blist Hugo Theme

repository·main·Indexed 18 days ago

https://github.com/apvarun/blist-hugo-theme

A clean, fast, and SEO-optimized blog theme for Hugo (version 0.110.0 or higher). Blist features responsive design, dark mode, customizable colors via Tailwind CSS, and built-in Fuse.js search. It supports LaTeX mathematical rendering via KaTeX, custom shortcodes for YouTube, Vimeo, and X (Twitter) embeds, and provides a dedicated css.inline shortcode for scoped styling.

Tokens
2.4K
Snippets
15
Records
19
Agent score
63%

What's inside blist

  1. Use the <!--more--> shortcode for post excerpts

    main

    To control where a blog post excerpt ends in list views, insert the <!--more--> HTML comment within your markdown content. Content appearing before this tag will be used as the summary/excerpt, while content after it will be part of the full post body.

    Lorem est tota propiore conpellat pectoribus de pectora summo. <!--more-->Redit teque digerit hominumque toris verebor lumina...
  2. Add blog content to Blist

    main

    The theme expects a specific directory structure for blog posts. You can follow the pattern found in the exampleSite/ folder:

    .
    ├── blog       # Blog Section
    │   ├── post1   # Post 1
    │   ├── post2   # Post 2
    │   └── _index
    └── ...
  3. Publish your website with CSS purging

    main

    When deploying to platforms like Netlify or Vercel, use the following command to build your site. Setting HUGO_ENVIRONMENT=production enables CSS purging for optimized performance.

    npm i && HUGO_ENVIRONMENT=production hugo --gc
  4. Preview the theme with example content

    main

    The theme includes a fully configured exampleSite. To preview it quickly:

    1. Navigate to the example site directory.
    2. Copy the package.json from the theme folder to your root (if not already done).
    3. Run npm install.
    4. Start the Hugo server pointing to the theme directory.
    cd themes/blist/exampleSite/
    hugo serve --themesDir ../..
  5. Enable math typesetting via KaTeX

    main

    The Blist theme supports server-side rendering of math equations using Hugo's built-in KaTeX engine. To use LaTeX expressions in your Markdown content, you must enable and configure the Hugo Goldmark passthrough extension in your hugo.yaml configuration file. This allows the Markdown parser to recognize specific delimiters for inline and block math.

    markup:
      goldmark:
        extensions:
          passthrough:
            delimiters:
              block: [['\[', '\]'], ['$$', '$$']]
              inline: [['\(', '\)']]
            enable: true
  6. Configure Blist theme in a Hugo website

    main

    Follow these steps to integrate the theme into your existing Hugo project:

    1. Copy package.json and package-lock.json from the theme folder to your website's root folder.
    2. Run npm install to install the required dependencies.
    3. Install postcss-cli globally to enable PostCSS support: npm i -g postcss-cli.
    4. In your hugo.toml file, set theme = 'blist'.
    5. Start your local development server using npm start.
    npm install
    npm i -g postcss-cli
    # Then in hugo.toml:
    theme = 'blist'
    # To run:
    npm start
  7. Install the Blist theme

    main

    To use the Blist theme, you must have Hugo version 0.110.0 or higher installed. You can install the theme by cloning the repository directly into your Hugo site's themes/ directory or by adding it as a git submodule.

    # Option 1: Clone directly
    git clone https://github.com/apvarun/blist-hugo-theme.git themes/blist
    
    # Option 2: Add as a git submodule
    git submodule add https://github.com/apvarun/blist-hugo-theme.git themes/blist
  8. Configure blog post front matter

    main

    When creating blog posts in the Blist theme, use Hugo front matter to define metadata. Key fields include author, title, date, description, tags, and thumbnail. The thumbnail field accepts a path to an image file used for post previews.

    ---
    author: "Hugo Authors"
    title: "Placeholder Text"
    date: 2021-07-13
    description: "Lorem Ipsum Dolor Si Amet"
    tags: ["markdown", "text"]
    thumbnail: /blog-post.jpg
    ---
  9. Supported Markdown and HTML elements in Blist

    main

    The Blist theme supports standard Markdown syntax and basic HTML elements for content creation. This includes:

    • Headings: # through ###### for H1 to H6.
    • Blockquotes: Standard > syntax, including support for citations using <cite> and footnotes.
    • Tables: Standard Markdown table syntax (supported out-of-the-box by Hugo).
    • Lists: Ordered (1.), Unordered (-), and nested lists.
    • Inline HTML Elements: The theme provides CSS decoration for:
      • <abbr> (Abbreviations)
      • <sub> (Subscript)
      • <sup> (Superscript)
      • <kbd> (Keyboard input)
      • <mark> (Highlighted text)
  10. Write inline and block math in Markdown

    main

    Once the passthrough extension is configured, you can use LaTeX syntax directly in your Markdown files.

    • Inline math: Use \( and \) delimiters to include math within a sentence.
    • Block math: Use $$ or \[ and \] delimiters to render math on its own separate paragraph/block.
    # Inline math
    Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
    
    # Block math
    $$\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }$$
  11. Configure site features in hugo.toml

    main

    You can customize various theme features using parameters in your hugo.toml file. It is recommended to copy the hugo.toml from exampleSite/ as a starting point.

    Use the logo parameter to use an image instead of the website name. This parameter is localizable.

    Dark Mode

    Enable the dark mode toggle in the header by setting [params.darkModeToggle]. User preferences are automatically saved for return visits.

    Color Customization

    Change the default accent color (default is pink) using [params.ascentColor]. Use any valid Tailwind CSS color class (e.g., bg-blue-200, bg-yellow-300).

    Enable the Fuse.js powered search by setting [params.enableSearch] = true. This adds a search icon to the header and enables searching via Ctrl/Cmd + /. Requirement: You must enable JSON in your [outputs] array for search to work:

    [outputs]
      home = ["HTML", "RSS", "JSON"]

    LaTeX

    To enable mathematical rendering, add math: true to the frontmatter of your Markdown files.