Explorar o código

publication: Allow date format to be changed (#336)

* Add `[params.publications]` section to `config.toml`
George Cushen %!s(int64=7) %!d(string=hai) anos
pai
achega
229629b772
Modificáronse 2 ficheiros con 7 adicións e 1 borrados
  1. 6 0
      exampleSite/config.toml
  2. 1 1
      layouts/publication/single.html

+ 6 - 0
exampleSite/config.toml

@@ -141,6 +141,12 @@ defaultContentLanguageInSubdir = false
     'Book chapter'  # 6
   ]
 
+  # Configuration of publication pages.
+  [params.publications]
+    # Date format (refer to Go's date format: http://flippinggodateformat.com )
+    #   Examples: "Mon, Jan 2, 2006" or "2006-01-02"
+    date_format = "January, 2006"
+
   # Configuration of project pages.
   [params.projects]
     # List publications and talks related to the project?

+ 1 - 1
layouts/publication/single.html

@@ -64,7 +64,7 @@
       <div class="row">
         <div class="col-xs-12 col-sm-3 pub-row-heading">{{ i18n "date" }}</div>
         <div class="col-xs-12 col-sm-9" itemprop="datePublished">
-          {{ .Date.Format "January, 2006" }}
+          {{ .Date.Format ($.Site.Params.publications.date_format | default "January, 2006") }}
         </div>
       </div>
     </div>