Double URL from Page Bundle

Might be doing this wrong, but I’ve made a page bundle that looks like this:

[agd@clavain content]$ tree 
.
├── about
│   └── _index.md
└── posts
    ├── from-ghost-to-hugo.md
    ├── planning-iceland-scotland-england
    │   ├── google-calendar.png
    │   ├── google-my-maps.jpg
    │   └── index.md

the post for “planning iceland scotland england” makes it into my list, however the URL for this page is a doubled up version of the slug, for example: /posts/planning-iceland-scotland-england/planning-iceland-scotland-england/, however if I rename index.md to _index.md the post won’t show up in my list.

I suspect I might be doing something wrong in my list enumeration of posts? If so, here is that from my template:

{{ define "main" }}
	<main class="content" role="main">
		<div class="container">
			{{ range .Paginator.Pages }}
				<article class="li {{ .Type }}">
				    <header class="post-header">
		        		<h3 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
		        		<p class="post-time"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">{{ .Date.Format "January 2, 2006" }}</time></p>
		    		</header>
		    		<section class="post-excerpt">
		       			<p>{{ .Description }}</p>
		    		</section>
		    		<footer class="post-footer">
				        <span>
				        	&nbsp;&nbsp;<i class="fa fa-tag"></i>
							{{ range .Params.tags }}
							<a href="/tags/{{ . | urlize }}">{{ . }}</a>
							{{ end }}
				        </span>
		    		</footer>
		    	</article>
			{{ end }}
		</div>
	</main>
{{ end }}

In your config.toml what is your setting for post permalinks?

Also, what does the front matter look like for index.md?

I dont have anything in my config.toml for post permalinks (should I add something?)

---
title : "Planning Iceland, Scotland, England"
slug: "planning-iceland-scotland-england"
date : 2017-02-12T18:31:42-04:00
draft : false
tags :
- travel
---

Nope, was just wondering if you had that set.

What does the URL look like if you temporarily remove the slug from the front matter?

Also, what happens if you add this to your config.yaml?

permalinks:
  post: /posts/:slug/

(Or if you use a config.toml try this)

[permalinks]
  post = "/posts/:slug/“
[permalinks]
  post = "/posts/:slug/“

Adding the above to the config doesn’t seem to change the behavior. However removing the slug entirely does eliminate the double URL. I’d like to keep a slug in the front matter though…

One small change, try posts instead of post

[permalinks]
  posts = "/posts/:slug/“

Your code and settings are fine.

There is currently an opened issue about the slug being appended to the directory name of the Leaf Bundle.

If you remove this redundant (here) slug from the Front Matter, your URL will be fine.
I understand the slug often matters, in any case it did for me when I opened this issue.

1 Like

Ah thank you! I’ll subscribe to the bug and follow!

1 Like