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

Support page bundles #5

Open
GeertvanHorrik opened this issue May 18, 2020 · 1 comment
Open

Support page bundles #5

GeertvanHorrik opened this issue May 18, 2020 · 1 comment

Comments

@GeertvanHorrik
Copy link

I was experimenting with page bundles (keeping content & images together), but it was not showing any content.

I have updated the list template to this:

{{ define "main" }}
    {{ if .Content }}
        {{ .Content }}
    {{ else }}
        <div class="section">
            <dev class="section-title">{{.Section}}</dev>
            {{ range $index, $element := .Paginator.Pages }}
                <div class="list-item">
                    <a class="entry-title" href="{{ .URL }}">{{ .Title }}</a>
                    {{$page := .}}
                    {{with .Description}}
                    <p>{{.}}</p>
                    {{end}}
                    <div class="meta">
                    {{with .Date}}
                        <i class="far fa-calendar-alt"></i> {{.Format "Jan 2 2006"}}
                    {{end}}
                    <br>
                    {{with .Params.tags}}
                            <i class="fas fa-tags"></i> 
                            Tags: {{ delimit . ", " }}
                    {{end}}
                    </div>
                </div>
            {{end}}
        </div>
        {{ partial "pagination.html" $ }}
    {{end}}
{{end}}

This allows me to organize content like this:

/blog
  /2020
    /04
      /my-title
        /_index.md
        /myimage.png

@GeertvanHorrik
Copy link
Author

Looks like this is only required when using _index.md instead of index.md. The latter is required for posts to show up in the recent blog posts anyway, so I'd recommend to use index.md when using page bundles for blog posts.

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

1 participant