gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
74.8k stars 7.46k forks source link

hugo import jekyll fails for jekyll projects with nested _posts directories #1890

Closed davepeck closed 7 years ago

davepeck commented 8 years ago

With modern Jekyll, it's possible to nest _posts directories deeper in the hierarchy:

.
├── _config.yml
├── blog
|   ├── index.html
|   ├── _posts
|       └─── 2016-02-23-a-post-to-my-blog.md    
├── photoblog
|   ├── _index.html
|   ├── _posts
|       └─── 2016-02-23-a-photo-post.md
└── index.html

Hugo's import jekyll doesn't appear to know about this, and fails to import these posts correctly.

davepeck commented 8 years ago

Just to add a few notes:

Jekyll appears to look for _posts and _drafts in all directories it walks, so they can be nested arbitrarily deep. The superdirectory names above _posts appear to become part of of the post's categories. Other than that, a post's final resting location in the generated _site seems to depend only on the permalink setting, not its location in the source directory structure.

(There's also a curious comment in jekyll's categories_from_path implementation that seems to suggest there is some other meaning to subdirectories of a _posts directory. I've no idea what this is; might be of interest.)

Hugo's importer only looks for top-level _posts and _drafts directories. There's a split between that code (which imports posts) and the code that blindly copies what it believes to be static content; it seems like this needs to be restructured. Finally, I'm not sure I understand what the importer is doing with permalink but it might also need to be revisited.

davepeck commented 8 years ago

I took a quick stab at this, here: https://github.com/davepeck/hugo/commit/d6e225af7f0143fc3e5a5778886a8c84eb3ab764

Not suitable for a pull request; just a quick hack that might help someone.

bep commented 8 years ago

@coderzh there are couple of open issues/feature requests about the Jekyll importer now... Would this be something that you could have a look at?

coderzh commented 8 years ago

@bep I'd be glad to do something about these issues.

bep commented 8 years ago

@davepeck do you know any in-the-open (on GitHub) Jekyll sites with the "symptoms" of this and maybe the other issue(s) you have posted, that we could use to test this?

davepeck commented 8 years ago

I humbly offer my own personal blog as an example: https://github.com/davepeck/davepeck.org; it has both nested _posts and arbitrary files sitting around the hierarchy with YAML frontmatter.

I wonder if a cleverly crafted github search could get us some further examples?

Sorry I haven't had time to contribute code myself on this but hope at least the issues/comments were helpful.

bep commented 8 years ago

I humbly offer my own personal blog as an example

@davepeck And it is > 1 GB ... Could you take the PR referenced here for a spin and tell us if that works for you?

bep commented 7 years ago

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 commented 7 years ago

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.

github-actions[bot] commented 2 years ago

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.