Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable description to be displayed under title in the posts list page #99

Open
amrelhusseiny opened this issue Dec 5, 2022 · 2 comments

Comments

@amrelhusseiny
Copy link

Dear @vaga ,
Appreciate if you can enable a way to display the Front Matter "Description" under the title, so I can display a brief about an article .
Thank you so much for the theme, its perfect :) .
Amr

@mansoorbarri
Copy link

mansoorbarri commented Dec 29, 2024

@amrelhusseiny, you can do this by having a file called single.html in /layouts/_defaults/ with the following:

{{ define "main" }}
  <article class="post">
    <header class="post-header">
      <h1 class ="post-title">{{ .Title }}</h1>
      <h3 style="color:gray">{{ .Description }}</h3>
      {{- if ne .Type "page" }}
      <div class="post-meta">
        <div>
          {{ partial "icon.html" (dict "ctx" $ "name" "calendar") }}
          {{ .PublishDate.Format "Jan 2, 2006" }}
        </div>
        <div>
          {{ partial "icon.html" (dict "ctx" $ "name" "clock") }}
          {{ .ReadingTime }} min read
        </div>
        {{- with .Params.tags }}
        <div>
          {{ partial "icon.html" (dict "ctx" $ "name" "tag") }}
          {{- range . -}}
            {{ with $.Site.GetPage (printf "/%s/%s" "tags" . ) }}
              <a class="tag" href="{{ .Permalink }}">{{ .Title }}</a>
            {{- end }}
          {{- end }}
        </div>
        {{- end }}
      </div>
      {{- end }}
    </header>
    <div class="post-content">
      {{ .Content }}
    </div>
    <div class="post-footer">
      {{ template "_internal/disqus.html" . }}
    </div>
  </article>
{{ end }}

Explaination

the theme doesn't really support this feature as of now, however you can change the code as per your liking. The single.html controls the blog pages so adding the <h3 style="color:gray">{{ .Description }}</h3> after the title (after line 4) would display the description from the blogs' frontmatter.

@mansoorbarri
Copy link

mansoorbarri commented Dec 29, 2024

Could this issue be assigned to me so I can work on adding this feature to the theme? @vaga

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants