Double posts - Pure Theme

Hi, I wanted to truncate my long post on the Pure theme, which I managed to do by editing layouts/_default/list.html

But now I am showing double posts, the truncated version, and the full version. And even short posts are showing twice.

Well, there’s definitely something going on in that template then, but you have to share it with us if you want help with debugging. :blush:

yeah, that would have helped lol.

Here is how the template is

{{ define "main" }}
    {{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "post") (index .Site.Params "archive-paginate" | default 25) }}
    {{ range $paginator.Pages  }}
    <article>
        <header>
            {{ if .Title }}
            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
            {{ end }}
            <a href="{{ .Permalink }}" class="u-url">
                <time class="dt-published" datetime="{{ .Date.Format "2006-01-02 15:04:05-07:00" }}">
                    {{ .Date.Format "Jan 2, 2006" }}
                </time>
            </a>
        </header>
        {{ .Content }}
    </article>
    {{ end }}

    <nav>
        {{ if $paginator.HasPrev }}
        <a href="{{ $paginator.Prev.URL }}" title="Previous Page">
            ← Newer Posts
        </a>
        {{ end }}
        {{ if $paginator.HasNext }}
        <a href="{{ $paginator.Next.URL }}">
            Older Posts →
        </a>
        {{ end }}
    </nav>
{{ end }}

And this is what I am trying to modify it with, or at least its what I have done in other themes to make it work

    {{ if .Title }}
    <div class="e-summary">
    {{ .Summary }}
    {{ if .Truncated }}
    <p><a href="{{ .RelPermalink }}">Read More</a></p>
    {{ end }}
    </div>
    {{ else }}
    <div class="e-content">
    {{ .Content }}
    </div>
    {{ end }}

and I think I tried to paste it here, replacing {{ . Content }}

</header>
        {{ .Content }}
    </article>
    {{ end }}

Thanks, that’s definitely a step in the right direction. Even better would be the actual content of the modified file. :wink: If you’re unsure of where you pasted the change, the feedback you will get from me might be totally irrelevant if you, in reality, actually pasted that snippet somewhere else.

But let’s asume you did paste the snipped where you think. That gives us a layouts/_default/list.html template looking like this:

{{ define "main" }}
    {{ $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "post") (index .Site.Params "archive-paginate" | default 25) }}
    {{ range $paginator.Pages  }}
    <article>
        <header>
            {{ if .Title }}
            <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
            {{ end }}
            <a href="{{ .Permalink }}" class="u-url">
                <time class="dt-published" datetime="{{ .Date.Format "2006-01-02 15:04:05-07:00" }}">
                    {{ .Date.Format "Jan 2, 2006" }}
                </time>
            </a>
        </header>
        {{ if .Title }}
          <div class="e-summary">
            {{ .Summary }}
            {{ if .Truncated }}
              <p><a href="{{ .RelPermalink }}">Read More</a></p>
            {{ end }}
          </div>
        {{ else }}
          <div class="e-content">
            {{ .Content }}
          </div>
        {{ end }}
    </article>
    {{ end }}

    <nav>
        {{ if $paginator.HasPrev }}
        <a href="{{ $paginator.Prev.URL }}" title="Previous Page">
            ← Newer Posts
        </a>
        {{ end }}
        {{ if $paginator.HasNext }}
        <a href="{{ $paginator.Next.URL }}">```
            Older Posts →
        </a>
        {{ end }}
    </nav>
{{ end }}

And to me, that looks fine. I can’t see why you would get duplicates, and I just tried this custom template on my blog. No duplicates.

So maybe there’s something else going on? Have you tried forcing a rebuild of your site?

ha!! tried it again, no double posts!

thank you

Nice! Thanks for this snippet! For some reasons my pagination had disappeared the other day, could add it back!