Ghost theme 的坑
Table of contents
No headings in the article.
#toc#
1. ghost theme 的空格
{{#get "tags" limit="all" include="count.posts"}}
<li class="blog-card-by-tag">
{{#foreach tags}}
<div class="tag__name" href="{{url}}">{{name}}
({{count.posts}})</div>
<div class="blog-card__list">
{{#get
"posts" include="tags,authors" filter="tag:{{slug}}"
as |article|
}}
{{#foreach article}}
......
......
<div class="post__author">
{{authors}}
</div>
在這個地方,如果寫的是 include="tags, authors"
中間有空格,那麼就會出錯,{{authors}}
拿不到內容。
必須中間沒有空格才可以順利拿到。
跟今天遇到的 ... 出不來問題
我寫了
overflow-hidden text-ellipsis text-nowrap
但 title 還是沒有 ... ,經過老闆幫忙發現,我是寫了<div class="title"> {{#tag}} <div>{{name}}</div> {{/tag}} </div>
這樣 style 就定在外面一層的 div 了,正確的寫法應該是:
<div class="title">
{{#tag}}
{{name}}
{{/tag}}
</div>
還蠻低級的小錯誤,以後不要再犯了。