Your sites Log in Sign up Menu

Make H1 Link to Post on Entries Page

I've seen on other templates that you can make the title/h1 act as a URL to the entry. On my template, it's the date that acts as the permalink. I'd like for the h1 to also be a link on the entry's page, but can't figure out how to change that anywhere in the template, since both entries.html and entry.html just load the html content directly with the {{{html}}} variable. Am I missing something?


2 years ago, 1 replies   Improve this question

I figured out a solution. In entries.html, I commented out the {{{html}}} variable and then added an h1 populated by the {{{url}}}, {{{title}}} variables, and then {{{body}}}.

For the curious, here's my whole entries.html:

   <!DOCTYPE html>
<html>
  {{> head}}
  <body>
    {{> header}}
    <div class="container">
      <div class="main">
        {{#entries}}
        <div class="entry">
          <!-- <a class="small date left margin" href="{{url}}">{{date}} ⌘</a> -->
          <p class="small date left margin">{{date}}</p>
          <!-- {{{html}}} -->

          <h1><a class="entries" href="{{{url}}}">{{{title}}}</a></h1>
            {{{body}}}

          {{#tags}}
          <a class="small tag" href="/tagged/{{slug}}">{{name}}</a>
          {{/tags}}
          <div class="clear"></div>
        </div>
        <hr class="red" />
        {{/entries}}
        {{#pagination}}
        <div class="pagination">
          {{#next}}
            <a href="/page/{{next}}">❮ Older</a>
          {{/next}}
          {{#previous}}
            <a href="/page/{{previous}}">Newer ❯</a>
          {{/previous}}
        </div>
        {{/pagination}}
        {{> footer}}
      </div>
    </div>
  </body>
</html>
Answered 2 years ago · Improve this answer