Ver código fonte

Improve rendering of post summaries

George Cushen 9 anos atrás
pai
commit
1f77c0572b

+ 1 - 1
exampleSite/content/post/getting-started.md

@@ -18,7 +18,7 @@ Key features:
 - Responsive and mobile friendly
 - Simple and refreshing one page design
 - Easy to customize
-
+<!--more-->
 
 ## Installation
 

+ 1 - 1
exampleSite/content/post/writing-markdown-latex.md

@@ -6,7 +6,7 @@ title = "Writing content with Markdown, LaTeX, and Shortcodes"
 math = true
 +++
 
-Content can be written using [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet), [LaTeX math](https://en.wikibooks.org/wiki/LaTeX/Mathematics), and [Hugo Shortcodes](http://gohugo.io/extras/shortcodes/). Additionally, HTML may be used for advanced formatting.
+Content can be written using [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet), [LaTeX math](https://en.wikibooks.org/wiki/LaTeX/Mathematics), and [Hugo Shortcodes](http://gohugo.io/extras/shortcodes/). Additionally, HTML may be used for advanced formatting.<!--more-->
 
 ## Sub-headings
 

+ 1 - 1
layouts/index.html

@@ -112,7 +112,7 @@
                     {{ partial "article_metadata" (dict "content" . "is_list" 1) }}
                     <p class="article-style" itemprop="articleBody">
                         {{ if .Truncated }}
-                            {{ .Summary }}
+                            {{ printf "%s" .Summary | markdownify }}
                         {{ else }}
                             {{ .Content }}
                         {{ end }}

+ 7 - 1
layouts/section/post.html

@@ -14,7 +14,13 @@
         {{end}}
         <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
         {{ partial "article_metadata" (dict "content" . "is_list" 1) }}
-        <div class="article-style"><p>{{ .Summary }}</p></div>
+        <div class="article-style"><p>
+            {{ if .Truncated }}
+                {{ printf "%s" .Summary | markdownify }}
+            {{ else }}
+                {{ .Content }}
+            {{ end }}
+        </p></div>
     </div>
     {{ end }}