Add copy button to code snippets in Hugo
- Resources: - https://digitaldrummerj.me/hugo-add-copy-code-snippet-button/ - https://aaronluna.dev/blog/add-copy-button-to-code-blocks-hugo-chroma/ - https://www.dannyguo.com/blog/how-to-add-copy-to-clipboard-buttons-to-code-blocks-in-hugo/
This is a walk through on how to build a site from scratch with Hugo.
# create a repo on github called blog to host our actual blog code and drafts and stuff also called BLOG REPO. # create a repo on github sirajudheenam.github.io to host our static assets also called PRODUCTION REPO brew install hugo # clone the blog github repo locally git clone git@github.com:sirajudheenam/blog.git cd blog hugo new site sirajudheenblog cd themes # Pick a theme.
Use this command to build and find out
HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true \ HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true \ hugo && grep -inorE "<\!-- raw HTML omitted -->|ZgotmplZ|\[i18n\]|\(<nil>\)|(<nil>)|hahahugo" public/ sam@SamsMacBookPro ~/w/t/t/technotipstoday-hugo (main)> HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true \ HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo \ && grep -inorE "<\!-- raw HTML omitted -->|ZgotmplZ|\[i18n\]|\(<nil>\)|(<nil>)|hahahugo" public/ Start building sites … hugo v0.120.4-f11bca5fec2ebb3a02727fb2a5cfb08da96fd9df+extended darwin/arm64 BuildDate=2023-11-08T11:18:07Z VendorInfo=brew | EN -------------------+----- Pages | 76 Paginator pages | 1 Non-page files | 1 Static files | 16 Processed images | 0 Aliases | 28 Sitemaps | 1 Cleaned | 0 Total in 59 ms public//tech/so-you-are-a-computer-science-student/index.
How I deployed a Hugo Site on my github page Install hugo Locally brew install hugo hugo version hugo new site blog cd blog # add a theme # list of themes: https://themes.gohugo.io/ git init. git submodule add https://github.com/razonyang/hugo-theme-bootstrap themes/hugo-theme-bootstrap echo theme = \"hugo-theme-bootstrap\" >> config.toml hugo new posts/my-first-post.md cat >> posts/my-first-post.md <<EOF --- title: "First Post" date: 2019-03-26T08:47:11+01:00 draft: false --- # This is the heading of my first post EOF hugo server # or For full rebuilds on change: hugo server --disableFastRender http://localhost:1313/ Create a file in .
Tip 1: Sometimes, you really don’t wish to pluralize the menu items in Hugo. How can you do that?
```bash
edit config.yml pluralizelisttitles: “false”
OR edit config.toml pluralizelisttitles = false ```
Also the command can tell you whether the list is plural or not `bash hugo config \`
Tip 2: How to enable syntax highlighting in Hugo?
To enable syntax highlighting in Hugo, you need to configure your config.toml file:
bundle exec jekyll serve
When I tried to serve jekyll locally I get this.
cannot load such file -- webrick (LoadError) Incremental build: disabled. Enable with --incremental Generating... Jekyll Feed: Generating feed for posts done in 0.196 seconds. Auto-regeneration: enabled for '/Users/i072278/Development/github.com/sirajudheenam/sirajudheenam.github.io/docs' ..../.rvm/gems/ruby-3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3 :in `require': cannot load such file -- webrick (LoadError) Solution: # This is because webrick is no longer a bundled gem in Ruby 3.0. # let us add manually to our project bundle add webrick bundle exec jekyll serve Hurray, It works !