mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-14 20:37:55 -05:00
807c551922
e5e98b950 Update code-toggle.md 340c9c623 Update 'Fetch from Github' installation instructions in line with Github README d9f06c23c Add tip about clearing browser cache (#608) 7c9df4731 Adding Remark as additional Comments Alternatives for hugo (#607) b1ce8bf02 Revert "Temp change of baseURL" fdbc582ff Temp change of baseURL 5ec663bd6 Fix wrong date in frontmatter config example (#602) 0b3022eb1 Fix broken link to https://www.wercker.com (#603) b4a7e31a6 Turn off minification bfcc1ac21 Add a Tweet 8be09c0b4 Remove unused data file git-subtree-dir: docs git-subtree-split: e5e98b950ca631c3135ac2f4446c79d71d2196be
79 lines
2 KiB
Markdown
79 lines
2 KiB
Markdown
---
|
|
title: Code Toggle
|
|
description: Code Toggle tryout and showcase.
|
|
date: 2018-03-16
|
|
categories: [getting started,fundamentals]
|
|
keywords: [configuration,toml,yaml,json]
|
|
weight: 60
|
|
sections_weight: 60
|
|
draft: false
|
|
toc: true
|
|
---
|
|
|
|
## The Config Toggler!
|
|
|
|
This is an example for the Config Toggle shortcode.
|
|
Its purpose is to let users choose a Config language by clicking on its corresponding tab. Upon doing so, every Code toggler on the page will be switched to the target language. Also, target language will be saved in user's `localStorage` so when they go to a different pages, Code Toggler display their last "toggled" config language.
|
|
|
|
{{% note %}}
|
|
The `code-toggler` shortcode is not an internal Hugo shortcode. This page's purpose is to test out a custom feature that we use throughout this site. See: https://github.com/gohugoio/gohugoioTheme/blob/master/layouts/shortcodes/code-toggle.html
|
|
{{% /note %}}
|
|
|
|
## That Config Toggler
|
|
|
|
{{< code-toggle file="config">}}
|
|
|
|
baseURL: "https://yoursite.example.com/"
|
|
title: "My Hugo Site"
|
|
footnoteReturnLinkContents: "↩"
|
|
permalinks:
|
|
post: /:year/:month/:title/
|
|
params:
|
|
Subtitle: "Hugo is Absurdly Fast!"
|
|
AuthorName: "Jon Doe"
|
|
GitHubUser: "spf13"
|
|
ListOfFoo:
|
|
- "foo1"
|
|
- "foo2"
|
|
SidebarRecentLimit: 5
|
|
{{< /code-toggle >}}
|
|
|
|
## Another Config Toggler!
|
|
|
|
{{< code-toggle file="theme">}}
|
|
|
|
# theme.toml template for a Hugo theme
|
|
|
|
name = "Hugo Theme"
|
|
license = "MIT"
|
|
licenselink = "https://github.com/budparr/gohugo.io/blob/master/LICENSE.md"
|
|
description = ""
|
|
homepage = "https://github.com/budparr/gohugo.io"
|
|
tags = ["website"]
|
|
features = ["", ""]
|
|
min_version = 0.18
|
|
|
|
[author]
|
|
name = "Bud Parr"
|
|
homepage = "https://github.com/budparr"
|
|
|
|
{{< /code-toggle >}}
|
|
|
|
## Two regular code blocks
|
|
|
|
{{< code file="bf-config.toml" >}}
|
|
[blackfriday]
|
|
angledQuotes = true
|
|
fractions = false
|
|
plainIDAnchors = true
|
|
extensions = ["hardLineBreak"]
|
|
{{< /code >}}
|
|
|
|
{{< code file="bf-config.yml" >}}
|
|
blackfriday:
|
|
angledQuotes: true
|
|
fractions: false
|
|
plainIDAnchors: true
|
|
extensions:
|
|
- hardLineBreak
|
|
{{< /code >}}
|