소스 검색

Update variables names to camelCase format for consistency (#473)

Clément Pannetier 5 년 전
부모
커밋
c5fbd48e91

+ 14 - 14
exampleSite/config.toml

@@ -1,16 +1,16 @@
-baseurl = "http://www.example.com"
+baseURL = "http://www.example.com"
 title = "johndoe"
 
 theme = "hugo-coder"
 
-languagecode = "en"
-defaultcontentlanguage = "en"
+languageCode = "en"
+defaultContentLanguage = "en"
 
 paginate = 20
 
-pygmentsstyle = "b2"
-pygmentscodefences = true
-pygmentscodefencesguesssyntax = true
+pygmentsStyle = "b2"
+pygmentsCodeFences = true
+pygmentsCodeFencesGuessSyntax = true
 
 disqusShortname = "yourdiscussshortname"
 
@@ -19,11 +19,11 @@ disqusShortname = "yourdiscussshortname"
     description = "John Doe's personal website"
     keywords = "blog,developer,personal"
     info = "Full Stack DevOps and Magician"
-    avatarurl = "images/avatar.jpg"
+    avatarURL = "images/avatar.jpg"
     #gravatar = "john.doe@example.com"
-    footercontent = "Enter a text here."
+    footerContent = "Enter a text here."
 
-    dateformat = "January 2, 2006"
+    dateFormat = "January 2, 2006"
 
     hideFooter = false
     hideCredits = false
@@ -40,10 +40,10 @@ disqusShortname = "yourdiscussshortname"
     # "auto" (use preference set by browser)
     # "dark" (dark background, light foreground)
     # "light" (light background, dark foreground) (default)
-    colorscheme = "auto"
+    colorScheme = "auto"
 
     # Hide the toggle button, along with the associated vertical divider
-    hidecolorschemetoggle = false
+    hideColorSchemeToggle = false
 
     # Series see also post count
     maxSeeAlsoItems = 5
@@ -118,7 +118,7 @@ disqusShortname = "yourdiscussshortname"
 
 [languages]
     [languages.en]
-        languagename = "English"
+        languageName = "English"
 
         [languages.en.menu]
 
@@ -144,7 +144,7 @@ disqusShortname = "yourdiscussshortname"
 
 
     [languages.pt-br]
-        languagename = "Português"
+        languageName = "Português"
         title = "João Ninguém"
 
         [languages.pt-br.params]
@@ -152,7 +152,7 @@ disqusShortname = "yourdiscussshortname"
             info = "Full Stack DevOps e Mágico"
             description = "Sítio pessoal de João Ninguém"
             keywords = "blog,desenvolvedor,pessoal"
-            footercontent = "Coloque algum texto aqui."
+            footerContent = "Coloque algum texto aqui."
 
         [languages.pt-br.menu]
 

+ 1 - 1
exampleSite/content/posts/creating-a-new-theme.md

@@ -309,7 +309,7 @@ Edit the file to add the theme, add a title for the site, and specify that all o
 ```
 $ vi config.toml
 theme = "zafta"
-baseurl = ""
+baseURL = ""
 languageCode = "en-us"
 title = "zafta - totally refreshing"
 MetaDataFormat = "toml"

+ 1 - 1
exampleSite/content/posts/goisforlovers.md

@@ -241,7 +241,7 @@ instead of depending on the context.
 
       {{ $title := .Site.Title }}
       {{ range .Params.tags }}
-        <li> <a href="{{ $baseurl }}/tags/{{ . | urlize }}">{{ . }}</a> - {{ $title }} </li>
+        <li> <a href="{{ $baseURL }}/tags/{{ . | urlize }}">{{ . }}</a> - {{ $title }} </li>
       {{ end }}
 
 Notice how once we have entered the loop the value of {{ . }} has changed. We

+ 1 - 1
exampleSite/content/posts/hugoisforlovers.md

@@ -12,7 +12,7 @@ categories = [
     "golang",
 ]
 series = ["Getting Started", "Hugo"]
-featured_image = "https://imgs.xkcd.com/comics/angular_momentum.jpg"
+featuredImage = "https://imgs.xkcd.com/comics/angular_momentum.jpg"
 +++
 
 ## Step 1. Install Hugo

+ 4 - 4
layouts/_default/baseof.html

@@ -45,7 +45,7 @@
       {{ end }}
     {{ end }}
 
-    {{ if  or (eq .Site.Params.colorscheme "auto") (eq .Site.Params.colorscheme "dark") }}
+    {{ if  or (eq .Site.Params.colorScheme "auto") (eq .Site.Params.colorScheme "dark") }}
       {{ if .Site.IsServer }}
         {{ $cssOpts := (dict "targetPath" "css/coder-dark.css" "enableSourceMap" true ) }}
         {{ $styles := resources.Get "scss/coder-dark.scss" | resources.ExecuteAsTemplate "style.coder-dark.css" . | toCSS $cssOpts }}
@@ -91,9 +91,9 @@
   </head>
 
   {{ $csClass := "colorscheme-light" }}
-  {{ if eq .Site.Params.colorscheme "dark" }}
+  {{ if eq .Site.Params.colorScheme "dark" }}
     {{ $csClass = "colorscheme-dark" }}
-  {{ else if eq .Site.Params.colorscheme "auto" }}
+  {{ else if eq .Site.Params.colorScheme "auto" }}
     {{ $csClass = "colorscheme-auto" }}
   {{ end }}
   <body class="{{ $csClass }}{{ if .Site.Params.rtl }} rtl{{ end }}"
@@ -110,7 +110,7 @@
       {{ partial "footer.html" . }}
     </main>
 
-    {{ if not .Site.Params.hidecolorschemetoggle }}
+    {{ if not .Site.Params.hideColorSchemeToggle }}
       {{ if .Site.IsServer }}
         {{ $script := resources.Get "js/dark-mode.js" }}
         <script src="{{ $script.RelPermalink }}"></script>

+ 1 - 1
layouts/partials/float.html

@@ -1,4 +1,4 @@
-{{ if not .Site.Params.hidecolorschemetoggle }}
+{{ if not .Site.Params.hideColorSchemeToggle }}
 <div class="float-container">
     <a id="dark-mode-toggle" class="colorscheme-toggle">
         <i class="fa fa-adjust fa-fw" aria-hidden="true"></i>

+ 2 - 2
layouts/partials/footer.html

@@ -1,7 +1,7 @@
 {{ if not .Site.Params.hideFooter | default false }}
   <footer class="footer">
     <section class="container">
-      {{ with .Site.Params.footercontent | safeHTML }}
+      {{ with .Site.Params.footerContent | safeHTML }}
         <p>{{ . }}</p>
       {{ end }}
       {{ if not .Site.Params.hideCopyright }}
@@ -10,7 +10,7 @@
           {{ .Site.Params.since }} -
         {{ end }}
         {{ now.Year }}
-        {{ with .Site.Params.Author }} {{ . }} {{ end }}
+        {{ with .Site.Params.author }} {{ . }} {{ end }}
       {{ end }}
       {{ if not .Site.Params.hideCredits }}
         {{ if not .Site.Params.hideCopyright }} · {{ end }}

+ 1 - 1
layouts/partials/home.html

@@ -1,7 +1,7 @@
 <section class="container centered">
   <div class="about">
     {{ if and (isset .Site.Params "avatarurl") (not (isset .Site.Params "gravatar")) }}
-      {{ with .Site.Params.avatarurl }}
+      {{ with .Site.Params.avatarURL }}
         <div class="avatar"><img src="{{ . | relURL }}" alt="avatar"></div>
       {{ end }}
     {{ end }}

+ 1 - 1
layouts/partials/list.html

@@ -12,7 +12,7 @@
     {{ range .Paginator.Pages }}
     <li>
       <span class="date">{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</span>
-      <a class="title" href="{{ .Params.ExternalLink | default .RelPermalink }}">{{ .Title }}</a>
+      <a class="title" href="{{ .Params.externalLink | default .RelPermalink }}">{{ .Title }}</a>
     </li>
     {{ end }}
   </ul>

+ 2 - 2
layouts/partials/posts/commento.html

@@ -1,4 +1,4 @@
-{{- if and (isset .Site.Params "commentourl") (not (eq .Site.Params.commentoUrl "" )) (eq (.Params.disable_comments | default false) false) -}}
+{{- if and (isset .Site.Params "commentourl") (not (eq .Site.Params.commentoURL "" )) (eq (.Params.disableComments | default false) false) -}}
 <div id="commento"></div>
-<script src="{{ .Site.Params.commentoUrl }}/js/commento.js"></script>
+<script src="{{ .Site.Params.commentoURL }}/js/commento.js"></script>
 {{- end -}}

+ 1 - 1
layouts/partials/posts/disqus.html

@@ -1,3 +1,3 @@
-{{- if and (not (eq (.Site.DisqusShortname | default "") "")) (eq (.Params.disable_comments | default false) false) -}}
+{{- if and (not (eq (.Site.DisqusShortname | default "") "")) (eq (.Params.disableComments | default false) false) -}}
   {{ template "_internal/disqus.html" . }}
 {{- end -}}

+ 1 - 1
layouts/partials/posts/series.html

@@ -12,7 +12,7 @@
         {{ range first (add $maxItems 1) $series.Pages }}
           {{ if ne .RelPermalink $currentPageUrl }}
             <li>
-              <a href="{{ .Params.ExternalLink | default .RelPermalink }}">{{ .Title }}</a>
+              <a href="{{ .Params.externalLink | default .RelPermalink }}">{{ .Title }}</a>
             </li>
           {{ end }}
         {{ end }}

+ 1 - 1
layouts/posts/li.html

@@ -1,4 +1,4 @@
 <li>
   <span class="date">{{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</span>
-  <a class="title" href="{{ .Params.ExternalLink | default .RelPermalink }}">{{ .Title }}</a>
+  <a class="title" href="{{ .Params.externalLink | default .RelPermalink }}">{{ .Title }}</a>
 </li>

+ 2 - 2
layouts/posts/single.html

@@ -28,8 +28,8 @@
       </header>
 
       <div>
-        {{ if .Params.featured_image }}
-          <img src='{{ .Params.featured_image }}' alt="Featured image"/>
+        {{ if .Params.featuredImage }}
+          <img src='{{ .Params.featuredImage }}' alt="Featured image"/>
         {{ end }}
         {{ .Content }}
       </div>

+ 15 - 15
stackbit.yaml

@@ -17,13 +17,13 @@ models:
         label: Title
         required: true
       - type: string
-        name: baseurl
+        name: baseURL
         label: Base URL
         description: Hostname (and path) to the root
       - type: string
-        name: languagecode
+        name: languageCode
       - type: string
-        name: defaultcontentlanguage
+        name: defaultContentLanguage
       - type: string
         name: themesDir
       - type: string
@@ -32,13 +32,13 @@ models:
       - type: number
         name: paginate
       - type: boolean
-        name: canonifyurls
+        name: canonifyURLs
       - type: string
-        name: pygmentsstyle
+        name: pygmentsStyle
       - type: boolean
-        name: pygmentscodefences
+        name: pygmentsCodeFences
       - type: boolean
-        name: pygmentscodefencesguesssyntax
+        name: pygmentsCodeFencesGuessSyntax
       - type: string
         name: disqusShortname
       - type: object
@@ -55,19 +55,19 @@ models:
           - type: string
             name: info
           - type: string
-            name: avatarurl
+            name: avatarURL
           - type: boolean
             name: hideFooter
           - type: string
-            name: footercontent
+            name: footerContent
           - type: string
-            name: dateformat
+            name: dateFormat
           - type: boolean
             name: hideCredits
           - type: boolean
             name: hideCopyright
           - type: boolean
-            name: hidecolorschemetoggle
+            name: hideColorSchemeToggle
           - type: number
             name: since
           - type: string
@@ -75,7 +75,7 @@ models:
           - type: boolean
             name: rtl
           - type: string
-            name: colorscheme
+            name: colorScheme
           - type: number
             name: maxSeeAlsoItems
           - type: list
@@ -215,7 +215,7 @@ models:
         items:
           type: string
       - type: image
-        name: featured_image
+        name: featuredImage
         label: Featured Image
         description: Image featured in post display
   snippets:
@@ -231,7 +231,7 @@ models:
     label: Language Config
     fields:
       - type: string
-        name: languagename
+        name: languageName
       - type: string
         name: title
       - type: object
@@ -246,7 +246,7 @@ models:
           - type: string
             name: keywords
           - type: string
-            name: footercontent
+            name: footerContent
           - type: number
             name: since
       - type: object