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

import_jekyll: Only set 'url' if 'permalink' in metadata & remove duplicate confirm msg #4257

Merged
merged 1 commit into from
Jan 28, 2018
Merged

import_jekyll: Only set 'url' if 'permalink' in metadata & remove duplicate confirm msg #4257

merged 1 commit into from
Jan 28, 2018

Conversation

lildude
Copy link
Contributor

@lildude lildude commented Jan 11, 2018

When importing from Jekyll, Hugo adds the url attribute to the frontmatter for all posts and assumes that the final desired permalink structure is /:year/:month/:day/:title/.

This may be the case for a lot of 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 PR resolves this by only setting the url attribute if the permalink attribute is set in the Jekyll frontmatter.

Tests have been updated to reflect this change in behaviour too.

Whilst I'm at it, I've also removed the duplication of the confirmation message:

Before:

Importing...
Congratulations! 459 post(s) imported!
Now, start Hugo by yourself:
$ git clone https://github.com/spf13/herring-cove.git hugo-gfr-test/themes/herring-cove
$ cd hugo-gfr-test
$ hugo server --theme=herring-cove
Congratulations! 459 post(s) imported!
Now, start Hugo by yourself:
$ git clone https://github.com/spf13/herring-cove.git hugo-gfr-test/themes/herring-cove
$ cd hugo-gfr-test
$ hugo server --theme=herring-cove

After:

Importing...
Congratulations! 459 post(s) imported!
Now, start Hugo by yourself:
$ git clone https://github.com/spf13/herring-cove.git hugo-gfr-test/themes/herring-cove
$ cd hugo-gfr-test
$ hugo server --theme=herring-cove

Fixes #1887

PS. This my first Hugo (and Go) PR. Go easy on me 😉

@CLAassistant
Copy link

CLAassistant commented Jan 11, 2018

CLA assistant check
All committers have signed the CLA.

@lildude
Copy link
Contributor Author

lildude commented Jan 12, 2018

Looks like one of the builds timed out rather than failed.

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
@lildude
Copy link
Contributor Author

lildude commented Jan 28, 2018

Nudge. Have I missed something that is required for this to be reviewed and merged?

@bep bep merged commit 3752348 into gohugoio:master Jan 28, 2018
@lildude
Copy link
Contributor Author

lildude commented Jan 28, 2018

Wow!! That was quick!. Thanks @bep.

@lildude lildude deleted the cleaner-jekyll-import branch January 28, 2018 10:25
@github-actions
Copy link

github-actions bot commented Feb 7, 2022

This pull request 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 Feb 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"hugo import jekyll" convert all post with "url" cause permalink cohfiguration failed
3 participants