Hugo: Periods generating bad paths

Created on 21 Feb 2016  路  19Comments  路  Source: gohugoio/hugo

This issue is similar to #1188. If the permalink uses the title of the post and the title has a period in it, it generates some weird paths.

I expect title: testdot. to create testdot/index.html instead I get testdot/index. I experimented with a few different variations and they all give me weird results.
title: test.dot -> test/index.dot
title: .testdot -> /index.testdot (no folder)

The same thing seems to happen if using slug or filename in the permalink. If you have two, like :slug/:title it'll do the first fine but the end will still be wrong, making slug & title: test.dot generate test.dot/test/index.dot. Strangely enough it doesn't happen if I make a section called test.dot and set the permalink to :section. I've also tried with a few other symbols, but they all seem to work just fine.

Bug

All 19 comments

I cannot reproduce this on OS X, so I guess you are on Windows.

  • What is your OS and Hugo version?

Windows 10 64bit and Hugo version v0.15 BuildDate: 2015-11-25T14:35:20-03:00

Getting the same issue on Linux (Kubuntu 14.04), Hugo v0.16 BuildDate: 2016-06-12T11:47:29+03:00

I'm having the same problem. I'm using Hugo v0.16, on Windows 7 (AMD64).

Related to Pagination bug? #2636

My system details.

Linux server1 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux

Hugo Static Site Generator v0.17 BuildDate: 2016-10-11T20:48:48+03:00

I'm experiencing the same issue as described by @alansartlog (specifically title: test.dot -> test/index.dot) on Linux 4.8.8, x86_64.

Hugo version string: Hugo Static Site Generator v0.18-DEV BuildDate: 2016-11-16T19:07:41-05:00

Go version string: go version go1.7.3 linux/amd64

I am experiencing this on macOS 10.12.1 with Go 1.7.4 and Hugo Hugo Static Site Generator v0.18.1 BuildDate: 2016-12-29T10:12:41-07:00

I'm migrating a site from another generator. Pages migrated that have dots in the title line generate a different page structure from the link they generate:

$  head 2016-10-14-kubernetes-1-4-ama.html.md
---
title: Kubernetes 1.4 AMA Video
date: 2016-10-14
tags: [ kubernetes ]
---

The page generated is:

public/2016/10/14/kubernetes-1/index.4-ama-video

But the link appearing in content is: http://localhost:1313/2016/10/14/kubernetes-1.4-ama-video (which results in a 404)

Observation for https://github.com/spf13/hugo/issues/2915:
As far as I can see in the source code PagePub.TranslateRelative is responsible for this behaviour: https://github.com/spf13/hugo/blob/c38bfda43bde093aa5f3b3245e3d2de5190d1991/target/page.go#L61

translating paths accordingly:

authors/mateusz.gajewski to public/authors/mateusz/index.gajewski (wrong)
and
authors/mateusz_gajewski to public/authors/mateusz_gajewski/index.html (correct)

Here's a patch that fixed a problem for me (in my case): https://gist.github.com/wendigo/42e949e82a8eba3c03fab38d9d0585d0

Can someone provide a site repo that reproduces this error? Like bep, I'm not able to reproduce it.

Yes, I have one :)

@moorereason is this sufficient?

@wendigo,
Yes, notice the "thumbs up" on your previous comment. I just haven't had time to look into a fix.

This bug is still here for Hugo 0.19 on Windows 10.

Anyone know a workaround?

It will be fixed in 0.20, so I suggest you just live with it.

@bep - I hate to ask an OSS developer the most hated question :( - do you have a rough idea when that release will be stable?

@DarwinJS If you hate to ask then you should consider not asking. The release schedule is available somewhere else.

FYI - specifying a slug that uses a dash for the period worked fine for my case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ianbrandt picture ianbrandt  路  3Comments

vielmetti picture vielmetti  路  3Comments

mumblecrunch picture mumblecrunch  路  3Comments

geddski picture geddski  路  3Comments

sigma picture sigma  路  3Comments