mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-19 14:34:49 -04:00
Update inline code styles
This commit is contained in:
parent
03dc2766ac
commit
f9db26c544
15
content/content-management/aliases-redirects.md
Normal file
15
content/content-management/aliases-redirects.md
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Aliases/Redirects
|
||||
linktitle: Aliases/Redirects
|
||||
description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [aliases,redirects]
|
||||
categories: [content management]
|
||||
weight:
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
@ -2,9 +2,9 @@
|
||||
title: Archetypes
|
||||
linktitle:
|
||||
description: Archetypes allow you to create and set default parameters from the command line according to the content section.
|
||||
date: 2017-01-09
|
||||
publishdate: 2017-01-09
|
||||
lastmod: 2017-01-09
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [archetypes,generators]
|
||||
categories: [content]
|
||||
weight: 50
|
||||
@ -14,3 +14,142 @@ aliases: []
|
||||
notes:
|
||||
---
|
||||
|
||||
Hugo uses **archetypes** to facilitate creation of consistent metadata for content types across a website. Authors can use the the `hugo new` command combined with the file path from the [`content`][], an author could create an empty content file, with the date and title automatically defined in the front matter of the post. While this was a welcome feature, active writers need more flexibility.
|
||||
|
||||
```bash
|
||||
hugo new posts/my-first-post.md
|
||||
```
|
||||
|
||||
When defining a custom content type, you can use an **archetype** as a way to
|
||||
define the default metadata for a new post of that type.
|
||||
|
||||
**Archetypes** are quite literally archetypal content files with pre-configured
|
||||
[front matter][]. An archetype will populate each new
|
||||
content file of a given type with any default metadata you've defined whenever
|
||||
you run the `hugo new` command.
|
||||
|
||||
## Example
|
||||
|
||||
### 1. Creating an archetype
|
||||
|
||||
In the following example scenario, suppose we have a blog with a single content
|
||||
type (blog post). Our imaginary blog will use ‘tags’ and ‘categories’ for its
|
||||
taxonomies, so let's create an archetype file with ‘tags’ and ‘categories’
|
||||
predefined:
|
||||
|
||||
{{% input "archetypes/default.md" %}}
|
||||
```toml
|
||||
+++
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
+++
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
{{% caution ""%}}
|
||||
Some editors (e.g., Sublime, Emacs) do not insert an EOL (end-of-line) character at the end of the file (i.e. EOF). If you get a [strange EOF error](/troubleshooting/strange-eof-error/) when using `hugo new`, please open each archetype file (i.e. `archetypes/*.md`) and press <kbd>Enter</kbd> to type a carriage return after the closing `+++` or `---` as necessary.
|
||||
{{% /caution %}}
|
||||
|
||||
### 2. Using the archetype
|
||||
|
||||
Now, with `archetypes/default.md` in place, let's create a new post in the `post`
|
||||
section with the `hugo new` command:
|
||||
|
||||
$ hugo new post/my-new-post.md
|
||||
|
||||
Hugo will now create the file with the following contents:
|
||||
|
||||
{{% output "content/post/my-new-post.md" %}}
|
||||
```toml
|
||||
+++
|
||||
title = "my new post"
|
||||
date = "2015-01-12T19:20:04-07:00"
|
||||
tags = ["x", "y"]
|
||||
categories = ["x", "y"]
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
|
||||
We see that the `title` and `date` variables have been added, in addition to the `tags` and `categories` variables which were carried over from `archetype/default.md`.
|
||||
|
||||
Congratulations! We have successfully created an archetype and used it to
|
||||
quickly scaffold out a new post. But wait, what if we want to create some content that isn't exactly a blog post, like a profile for a musician? Let's see how using **archetypes** can help us out.
|
||||
|
||||
### Creating custom archetypes
|
||||
|
||||
Previously, we had created a new content type by adding a new subfolder to the content directory. In this case, its name would be `content/musician`. To begin using a `musician` archetype for each new `musician` post, we simply need to create a file named after the content type called `musician.md`, and put it in the `archetypes` directory, similar to the one below.
|
||||
|
||||
#### archetypes/musician.md
|
||||
|
||||
```toml
|
||||
+++
|
||||
name = ""
|
||||
bio = ""
|
||||
genre = ""
|
||||
+++
|
||||
```
|
||||
|
||||
Now, let's create a new musician.
|
||||
|
||||
$ hugo new musician/mozart.md
|
||||
|
||||
This time, Hugo recognizes our custom `musician` archetype and uses it instead of the default one. Take a look at the new `musician/mozart.md` post. You should see that the generated file's front matter now includes the variables `name`, `bio`, and `genre`.
|
||||
|
||||
#### content/musician/mozart.md
|
||||
|
||||
```toml
|
||||
+++
|
||||
title = "mozart"
|
||||
date = "2015-08-24T13:04:37+02:00"
|
||||
name = ""
|
||||
bio = ""
|
||||
genre = ""
|
||||
+++
|
||||
```
|
||||
|
||||
## Using a different front matter format
|
||||
|
||||
By default, the front matter will be created in the TOML format
|
||||
regardless of what format the archetype is using.
|
||||
|
||||
You can specify a different default format in your site-wide config file
|
||||
(e.g. `config.toml`) using the `MetaDataFormat` directive.
|
||||
Possible values are `"toml"`, `"yaml"` and `"json"`.
|
||||
|
||||
## Which archetype is being used
|
||||
|
||||
The following rules apply when creating new content:
|
||||
|
||||
* If an archetype with a filename matching the new post's [content type](/content/types) exists, it will be used.
|
||||
* If no match is found, `archetypes/default.md` will be used.
|
||||
* If neither is present and a theme is in use, then within the theme:
|
||||
* If an archetype with a filename that matches the content type being created, it will be used.
|
||||
* If no match is found, `archetypes/default.md` will be used.
|
||||
* If no archetype files are present, then the one that ships with Hugo will be used.
|
||||
|
||||
Hugo provides a simple archetype which sets the `title` (based on the
|
||||
file name) and the `date` in RFC 3339 format based on
|
||||
[`now()`][], which returns the current time.
|
||||
|
||||
{{% note "Dynamic Key-Values in Archetypes" %}}
|
||||
`hugo new` does *not* automatically add `draft = true` when the user
|
||||
provides an archetype. This is by design---the rationale is that the archetype should set its own value for all fields. `title` and `date`, which are dynamic and unique for each piece of content, are the sole exceptions.
|
||||
{{% /note %}}
|
||||
|
||||
The content type is automatically detected based on the file path passed to the
|
||||
Hugo CLI command:
|
||||
|
||||
```toml
|
||||
hugo new [my-content-type/post-name]
|
||||
```
|
||||
|
||||
To override the content type for a new post, include the `--kind` flag during creation.
|
||||
|
||||
{{% note "Using Theme Archetypes" %}}
|
||||
If you wish to use archetypes that ship with a theme, the theme be specified in your [`config`](/project-organization/configuration/) file.
|
||||
{{% /note %}}
|
||||
|
||||
[front matter]: /content-management/front-matter/
|
||||
[`content`]: /project-organization/directory-structure/
|
||||
[`now()`]: http://golang.org/pkg/time/#Now
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="code-copy" id="{{.Get 0 | urlize}}">
|
||||
<div class="code-copy-header output"><div class="action-buttons"></div><span class="filename" title="{{.Get 0}}"><strong><em>Renders to... </em></strong>{{.Get 0}}</span><i class="icon-{{index (split (.Get 0) ".") 1 }}"></i></div>
|
||||
<div class="code-copy-header output"><div class="action-buttons"></div><span class="filename" title="{{.Get 0}}">{{.Get 0}}</span><i class="icon-{{index (split (.Get 0) ".") 1 }}"></i></div>
|
||||
{{- .Inner -}}
|
||||
</div>
|
@ -1,3 +1,4 @@
|
||||
// Keywords and other highlight in this script have been modified for better selection of Hugo-specific keywords
|
||||
/*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */ ! function(e) {
|
||||
var n = "object" == typeof window && window || "object" == typeof self && self;
|
||||
"undefined" != typeof exports ? e(exports) : n && (n.hljs = e({}), "function" == typeof define && define.amd && define([], function() {
|
||||
@ -349,7 +350,7 @@ hljs.registerLanguage("bash", function(e) {
|
||||
var t = { cN: "variable", v: [{ b: /\$[\w\d#@][\w\d_]*/ }, { b: /\$\{(.*?)}/ }] },
|
||||
s = { cN: "string", b: /"/, e: /"/, c: [e.BE, t, { cN: "variable", b: /\$\(/, e: /\)/, c: [e.BE] }] },
|
||||
a = { cN: "string", b: /'/, e: /'/ };
|
||||
return { aliases: ["sh", "zsh"], l: /-?[a-z\._]+/, k: { keyword: "if then else elif fi for while in do done case esac function", literal: "true false", built_in: "break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp", _: "-ne -eq -lt -gt -f -d -e -s -l -a" }, c: [{ cN: "meta", b: /^#![^\n]+sh\s*$/, r: 10 }, { cN: "function", b: /\w[\w\d_]*\s*\(\s*\)\s*\{/, rB: !0, c: [e.inherit(e.TM, { b: /\w[\w\d_]*/ })], r: 0 }, e.HCM, s, a, t] }
|
||||
return { aliases: ["sh", "zsh"], l: /-?[a-z\._]+/, k: { keyword: "hugo if then else elif fi for while in do done case esac function", literal: "true false", built_in: "break cd continue eval exec exit export getopts hash pwd readonly new return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp", _: "-ne -eq -lt -gt -f -d -e -s -l -a" }, c: [{ cN: "meta", b: /^#![^\n]+sh\s*$/, r: 10 }, { cN: "function", b: /\w[\w\d_]*\s*\(\s*\)\s*\{/, rB: !0, c: [e.inherit(e.TM, { b: /\w[\w\d_]*/ })], r: 0 }, e.HCM, s, a, t] }
|
||||
});
|
||||
hljs.registerLanguage("http", function(e) {
|
||||
var t = "HTTP/[0-9\\.]+";
|
||||
|
@ -19,13 +19,14 @@ $hugo-yellow:#FCD804;
|
||||
$hugo-gold:#EBB951;
|
||||
$hugo-gray:#737373;
|
||||
$hugo-gray-dark:darken($hugo-gray,10%);
|
||||
$hugo-gray-light:lighten($hugo-gray,25%);
|
||||
$hugo-gray-light:lighten($hugo-gray,30%);
|
||||
$hugo-green:#00A88A;
|
||||
$hugo-green-light:#33BA91;
|
||||
$default-anchor-color:$hugo-pink;
|
||||
$default-anchor-weight: 500;
|
||||
$active-color: $default-anchor-color;
|
||||
|
||||
|
||||
//Document Body
|
||||
$body-bg-color:$hugo-white;
|
||||
|
||||
@ -54,6 +55,7 @@ $code-editor-header-bg-color: $hugo-gray-dark;
|
||||
$code-filename-color:#ffffff;
|
||||
$code-copy-button-color:#ffffff;
|
||||
$code-copy-button-text-color:$base-font-color;
|
||||
$inline-code-text-color:$hugo-pink-light;
|
||||
|
||||
//Sidebar
|
||||
$site-navigation-width: 280px;
|
||||
|
@ -97,6 +97,7 @@ margin-right:.3em;
|
||||
.icon-love:before { content: '\e81d'; } /* '' */
|
||||
.icon-mail:before { content: '\e821'; } /* '' */
|
||||
.icon-markdown:before { content: '\e80e'; } /* '' */
|
||||
.icon-md:before { content: '\e80e'; } /* '' */
|
||||
.icon-note:before { content: '\e80d'; } /* '' */
|
||||
.icon-opera:before { content: '\e842'; } /* '' */
|
||||
.icon-pdf:before { content: '\f1c1'; } /* '' */
|
||||
|
@ -2,7 +2,7 @@
|
||||
code,
|
||||
pre {
|
||||
font-family: $code-font-family;
|
||||
margin:0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.body-copy > pre {
|
||||
@ -13,14 +13,25 @@ pre {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.body-copy {
|
||||
p {
|
||||
code {
|
||||
display:inline-block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p code,
|
||||
li > code {
|
||||
font-size: .9em;
|
||||
color: $base-font-color;
|
||||
color: $inline-code-text-color;
|
||||
font-family: $code-font-family;
|
||||
border: 1px solid $hugo-gray-light;
|
||||
padding-left: .25em;
|
||||
padding-right: .25em;
|
||||
background-color: $code-block-background-color;
|
||||
border:none;
|
||||
outline:none;
|
||||
}
|
||||
|
||||
//for clipboard.js tooltip and button
|
||||
@ -28,7 +39,7 @@ div.code-copy {
|
||||
position: relative;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 32px;
|
||||
background-color:$code-block-background-color;
|
||||
background-color: $code-block-background-color;
|
||||
&:hover {
|
||||
button.copy-button {
|
||||
transition: all .2s ease-in-out;
|
||||
@ -59,7 +70,7 @@ button.copy-button {
|
||||
border-width: 0px;
|
||||
border-radius: 0px;
|
||||
color: $code-copy-button-text-color;
|
||||
font-weight:bold;
|
||||
font-weight: bold;
|
||||
&:hover {
|
||||
background-color: $hugo-blue;
|
||||
}
|
||||
@ -114,10 +125,10 @@ div.code-copy-header {
|
||||
span.filename {
|
||||
@include center;
|
||||
text-align: center;
|
||||
max-width: 50%;
|
||||
max-width: 60%;
|
||||
color: $code-filename-color;
|
||||
font-weight: 100;
|
||||
font-size: 15px!important;
|
||||
font-size: 13px;
|
||||
font-family: $systemfonts;
|
||||
}
|
||||
[class^="icon-"] {
|
||||
@ -323,16 +334,12 @@ div.code-copy-header {
|
||||
right: 100%
|
||||
}
|
||||
|
||||
|
||||
// /* Modified heavily from http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+go+markdown+scss&plugins=line-numbers */
|
||||
|
||||
|
||||
// /**
|
||||
// * prism.js default theme for JavaScript, CSS and HTML
|
||||
// * Based on dabblet (http://dabblet.com)
|
||||
// * @author Lea Verou
|
||||
// */
|
||||
|
||||
// code[class*="language-"],
|
||||
// pre[class*="language-"] {
|
||||
// color: $code-block-base-font-color;
|
||||
@ -348,7 +355,6 @@ div.code-copy-header {
|
||||
// tab-size: 2;
|
||||
// hyphens: none;
|
||||
// }
|
||||
|
||||
// pre[class*="language-"]::-moz-selection,
|
||||
// pre[class*="language-"]::-moz-selection,
|
||||
// code[class*="language-"]::-moz-selection,
|
||||
@ -356,7 +362,6 @@ div.code-copy-header {
|
||||
// text-shadow: none;
|
||||
// background: $hugo-blue-light;
|
||||
// }
|
||||
|
||||
// pre[class*="language-"]::selection,
|
||||
// pre[class*="language-"]::selection,
|
||||
// code[class*="language-"]::selection,
|
||||
@ -364,17 +369,13 @@ div.code-copy-header {
|
||||
// text-shadow: none;
|
||||
// background: $hugo-blue-light;
|
||||
// }
|
||||
|
||||
// @media print {
|
||||
// code[class*="language-"],
|
||||
// pre[class*="language-"] {
|
||||
// text-shadow: none;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// /* Code blocks */
|
||||
|
||||
// pre[class*="language-"],
|
||||
// code[class*="language-"] {
|
||||
// padding: 1em 1em 2em 1em;
|
||||
@ -382,30 +383,24 @@ div.code-copy-header {
|
||||
// overflow: auto;
|
||||
// background-color: $code-block-background-color;
|
||||
// }
|
||||
|
||||
// /* Inline code */
|
||||
|
||||
// :not(pre) > code[class*="language-"] {
|
||||
// padding: .1em;
|
||||
// border-radius: .3em;
|
||||
// white-space: normal;
|
||||
// }
|
||||
|
||||
// .token.comment,
|
||||
// .token.prolog,
|
||||
// .token.doctype,
|
||||
// .token.cdata {
|
||||
// color: $hugo-gray-dark;
|
||||
// }
|
||||
|
||||
// .token.punctuation {
|
||||
// color: #999;
|
||||
// }
|
||||
|
||||
// .namespace {
|
||||
// opacity: .7;
|
||||
// }
|
||||
|
||||
// .token.property,
|
||||
// .token.tag,
|
||||
// .token.boolean,
|
||||
@ -415,7 +410,6 @@ div.code-copy-header {
|
||||
// .token.deleted {
|
||||
// color: $hugo-pink;
|
||||
// }
|
||||
|
||||
// .token.selector,
|
||||
// .token.attr-name,
|
||||
// .token.string,
|
||||
@ -424,7 +418,6 @@ div.code-copy-header {
|
||||
// .token.inserted {
|
||||
// color: $hugo-green;
|
||||
// }
|
||||
|
||||
// .token.operator,
|
||||
// .token.entity,
|
||||
// .token.url,
|
||||
@ -432,36 +425,29 @@ div.code-copy-header {
|
||||
// .style .token.string {
|
||||
// color: $hugo-pink;
|
||||
// }
|
||||
|
||||
// .token.atrule,
|
||||
// .token.attr-value,
|
||||
// .token.keyword {
|
||||
// color: $hugo-blue;
|
||||
// }
|
||||
|
||||
// .token.function {
|
||||
// color: $hugo-gold;
|
||||
// }
|
||||
|
||||
// .token.regex,
|
||||
// .token.important,
|
||||
// .token.variable {
|
||||
// color: $hugo-gold
|
||||
// }
|
||||
|
||||
// .token.important,
|
||||
// .token.bold {
|
||||
// font-weight: bold;
|
||||
// }
|
||||
|
||||
// .token.italic {
|
||||
// font-style: italic;
|
||||
// }
|
||||
|
||||
// .token.entity {
|
||||
// cursor: help;
|
||||
// }
|
||||
|
||||
// // //Modifications,
|
||||
// // code.language-markdown {
|
||||
// // span.token.italic {
|
||||
|
@ -27,14 +27,14 @@ Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-lic
|
||||
.hljs-regexp,
|
||||
.hljs-literal,
|
||||
.hljs-link {
|
||||
color: #ae81ff;
|
||||
color: $hugo-blue;
|
||||
}
|
||||
|
||||
.hljs-code,
|
||||
.hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-selector-class {
|
||||
color: #a6e22e;
|
||||
color: $hugo-green-light;
|
||||
}
|
||||
|
||||
.hljs-strong {
|
||||
@ -49,17 +49,17 @@ Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-lic
|
||||
.hljs-selector-tag,
|
||||
.hljs-name,
|
||||
.hljs-attr {
|
||||
color: #f92672;
|
||||
color: $hugo-pink-light;
|
||||
}
|
||||
|
||||
.hljs-symbol,
|
||||
.hljs-attribute {
|
||||
color: #66d9ef;
|
||||
color: $hugo-blue-light;
|
||||
}
|
||||
|
||||
.hljs-params,
|
||||
.hljs-class .hljs-title {
|
||||
color: #f8f8f2;
|
||||
color: $hugo-white;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
@ -72,11 +72,11 @@ Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-lic
|
||||
.hljs-addition,
|
||||
.hljs-variable,
|
||||
.hljs-template-variable {
|
||||
color: #e6db74;
|
||||
color: $hugo-yellow;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-deletion,
|
||||
.hljs-meta {
|
||||
color: #75715e;
|
||||
color: $hugo-gray-light;
|
||||
}
|
2
themes/hugodocs/static/css/style.min.css
vendored
2
themes/hugodocs/static/css/style.min.css
vendored
File diff suppressed because one or more lines are too long
2
themes/hugodocs/static/js/script.min.js
vendored
2
themes/hugodocs/static/js/script.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user