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

"hugo import jekyll" convert all post with "url" cause permalink cohfiguration failed #1887

Closed
kkdai opened this issue Feb 22, 2016 · 4 comments · Fixed by #4257
Closed

"hugo import jekyll" convert all post with "url" cause permalink cohfiguration failed #1887

kkdai opened this issue Feb 22, 2016 · 4 comments · Fixed by #4257

Comments

@kkdai
Copy link

kkdai commented Feb 22, 2016

I love hugo, it is fast and great.
I try to use it to convert my blog from jekyll which run over decade and contain over 1000+ posts.
I found it will force to add "url" in every post which is /year/month/dat/postname.

for ex:


---
date: 2016-02-18T00:00:00Z
description: ""
tags: []
title: '[Visual Studio] Using Visual Studio 2015 to remote debugging C++ on linux'
url: /2016/02/18/vs-debug-linux-exe/

---

However it will conflict with my configuration of "permallink", I found it force to store the same "url" no matter your jekyll "permallink".

Here should be two approach of "url" generation rule:

  1. Load config from jekyll and parse "permallink" configuration to apply it.
  2. Just not use "url", let user to configuration whatever they want. (It might be some issue because the "title" in jekyll permalink, mean the "postname" in hugo but no permalink config with it.)

Any idea of this issue?

@geertjanvdk
Copy link

This is not a solution but a workaround (and possibly actually a good thing to do when moving).

I had the same issue just now and I had to remove the 'url' from the front matter. I am also trying to move to Hugo from Jekyll.

My solution was to replace the url with slug, and get rid of the date, so:

url = "/2013/04/11/connectorpython-sqlalchemy/"
# becomes:
slug = "connectorpython-sqlalchemy"

To do this, I simply used sed (on OS X):

for f in `find ./content/post/ -name "*.m*"`;
do
  sed -i.bak 's|url = "/..../../../\(.*\)."$|slug = "\1"|' $f;
done

The idea is that slug is really needed. I had URLs with %P, and hugo actually paniced on it. So the title could not be used, and slug had to be added.

@bep
Copy link
Member

bep commented Feb 28, 2017

This issue has been automatically marked as stale because it has not been commented on for at least four months.

The resources of the Hugo team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still valuable, please open a proposal at https://discuss.gohugo.io/.

This issue will automatically be closed in four months if no further activity occurs. Thank you for all your contributions.

@bep bep added the Stale label Feb 28, 2017
@bep
Copy link
Member

bep commented Mar 1, 2017

Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't.

If this is a bug and you can still reproduce this error on the latest release or the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.

@bep bep closed this as completed Mar 27, 2017
bep pushed a commit that referenced this issue Jan 28, 2018
The current behaviour addes a `url` attribute to the frontmatter of all posts imported from Jeklly and assumes the desired permalink structure is /:year/:month/:day/:title/. This may be the case for most peeps, but poses a problem for those that don't use this permalink structure as the `url` attribute takes precedence over the `permalink` attribute in the site-wide configuration meaning it can't be overruled.

This changes the behaviour to only set the `url` attribute if the `permalink` attribute is set in the Jekyll frontmatter.

The duplication of the confirmation message is also removed.

Tests have been updated to reflect this change in behaviour.

Fixes #1887
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants