How can i use ".Summary" instead of ".Title" when my md files don't have title

hello ,
sorry to trouble you, my question is

When title is null , how can i use summary instead ?

my blog.md like this , it have title

---
title: blog title
type: post
date: 2000-01-01T00:00:01+00:00

my twitter.md like that ,it don’t have title

---
type: post
date: 2009-07-17T00:20:31+00:00
archive: talk

now, i try to use “taxonomy.html” show the title list ,like :

the code can’t show the summary when i don’t have title

{{if $title = "" }} 
               {{ .Summary }}
 {{ else }}
              {{ .Title }}
 {{ end }}

and this code can’t work too.

{{ with .Site.Params.archive.talk}}
              {{ .Summary }}
{{ else }}
              {{ .Title }}
{{ end }}

so , please help . how to write ?

{{ .Title | default .Summary }} should work.

BUT you get very long URLs :wink:

2 Likes

thanks a lot

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.