SSG Hugo Setup

SSG Hugo Setup

List of all Chroma syntax highlighter lexers

Chroma is a general purpose syntax highlighter in pure Go programming language.

sources:
https://github.com/alecthomas/chroma
Chroma style gallery
Chroma on GitHub
List of all Chroma lexers

Supported languages

Prefix Language
A ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Awk
B Ballerina, Base Makefile, Bash, Batchfile, BlitzBasic, BNF, Brainfuck
C C, C#, C++, Cassandra CQL, CFEngine3, cfstatement/ColdFusion, CMake, COBOL, CSS, Cap'n Proto, Ceylon, ChaiScript, Cheetah, Clojure, CoffeeScript, Common Lisp, Coq, Crystal, Cython
D Dart, Diff, Django/Jinja, Docker, DTD
E EBNF, Elixir, Elm, EmacsLisp, Erlang
F Factor, Fish, Forth, Fortran, FSharp
G GAS, GDScript, GLSL, Genshi, Genshi HTML, Genshi Text, Gnuplot, Go, Go HTML Template, Go Text Template, Groovy
H Handlebars, Haskell, Haxe, Hexdump, HTML, HTTP, Hy
I Idris, INI, Io
J Java, JavaScript, JSON, Jsx, Julia, Jungle
K Kotlin
L Lighttpd configuration file, LLVM, Lua
M Mako, Markdown, Mason, Mathematica, MiniZinc, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
N NASM, Newspeak, Nginx configuration file, Nim, Nix
O Objective-C, OCaml, Octave, OpenSCAD, Org Mode
P PacmanConf, Perl, PHP, Pig, PkgConfig, Plaintext, PL/pgSQL, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, Protocol Buffer, Puppet, Python, Python 3
Q QBasic
R R, Racket, Ragel, reg, reStructuredText, Rexx, Ruby, Rust
S Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, systemd, Systemverilog
T TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData
V verilog, VHDL, VimL
W WDTE
X XML, Xorg
Y YAML

Aliases

For people migrating existing published content to Hugo static site generator, there’s a good chance you need a mechanism to handle redirecting old URLs. Luckily, redirects can be handled easily with aliases in Hugo.

Let’s assume you create a new piece of content at content/posts/my-new-blog-post.md with url www.yourwebname.com/posts/my-new-blog-post/. The content is a revision of your previous post at content/posts/my-old-blog-post.md with url www.yourwebname.com/posts/my-old-blog-post/. You can create an aliases field in the front matter of your new my-new-blog-post.md where you can add previous url paths. The following examples show how to create this filed in YAML front matter.

YAML Front Matter of our content/posts/my-new-blog-post.md

---
title: My New post
aliases: ["/posts/my-old-blog-post/", "/post/another-my-old-post-url/"]
---

How Hugo Aliases Work

When aliases are specified, Hugo creates a directory to match the alias entry. Inside the directory, Hugo creates an .html file specifying the canonical URL for the page and the new redirect target.

For example, a content file at posts/my-new-blog-post.md with the following in the front matter:

---
title: My New post
aliases: ["/posts/my-old-blog-post/"]
---

Assuming a baseURL of example.com, the contents of the auto-generated alias .html found at https://example.com/posts/my-old-blog-post/ will contain the following:

<!DOCTYPE html>
<html>
  <head>
    <title>https://example.com/posts/my-new-blog-post/</title>
    <link rel="canonical" href="https://example.com/posts/my-new-blog-post/"/>
    <meta name="robots" content="noindex">
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta http-equiv="refresh" content="0; url=https://example.com/posts/my-new-blog-post/"/>
  </head>
</html>

The http-equiv="refresh" line is what performs the redirect, in 0 seconds in this case. If an end user of your website goes to https://example.com/posts/my-old-blog-post/, they will now be automatically redirected to the newer, correct URL. The addition of <meta name="robots" content="noindex"> lets search engine bots know they they should not crawl and index your new alias page.


SUBSCRIBE FOR NEW ARTICLES