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

no image passthroughs when adding permalinks #57

Closed
autonome opened this issue Apr 26, 2020 · 6 comments
Closed

no image passthroughs when adding permalinks #57

autonome opened this issue Apr 26, 2020 · 6 comments

Comments

@autonome
Copy link

I'm migrating a blog with images in same directory as my content files (eg, .md and .png in same directory) and permalinks in YYYY/MM/DD/slug format... but the images are not getting copied into site output.

Eg, add png to the defaults in this repo:

templateFormats: [
  "png",
  "md",
  ...
]

With an input structure in posts directory of:

posts/mypost/index.md
posts/mypost/header.png

And update posts/posts.json with this line:

"permalink": "/{{page.date | date: '%Y/%m/%d'}}/{{page.fileSlug}}/index.html"

The output in _site in the permalink dir 2018/09/21/mypost/ has the html output but not the images.

Is there a way to do permalinks this way, such that all directory contents are copied?

@nhoizey
Copy link
Contributor

nhoizey commented Apr 29, 2020

@autonome I also have images in the same folder as Markdown files, one folder per publication.

I use addPassthroughCopy to copy files from these folders that are not computed by Eleventy:

https://github.com/nhoizey/nicolas-hoizey.com/blob/master/.eleventy.js#L171

But I have the exact same folder hierarchy in source and destination, that's not your case (yet?).

@autonome
Copy link
Author

@nhoizey thanks!

But I have the exact same folder hierarchy in source and destination, that's not your case (yet?).

Correct. My source is posts/post-title/ and my dest is YYYY/mm/dd/post-title/, accomplished via the permalink usage I posted above.

Adding permalinks via the permalink configuration property results in the correct folder structure and the content is transformed correctly (index.md -> index.html), but no static files (even with configured passthroughs) are moved to destination folder.

@nhoizey
Copy link
Contributor

nhoizey commented Apr 30, 2020

It doesn't work with addPassthroughCopy because the folders are not the same.

Another solution would be to add the image extensions to the templateFormats array, but I don't remember if it applies the permalink.

I used to use it instead of addPassthroughCopy, but I think I already had the same folders hierarchy.

@autonome
Copy link
Author

Another solution would be to add the image extensions to the templateFormats array, but I don't remember if it applies the permalink.

Sorry for not saying earlier - I did this immediately, is pretty much a requirement unless you have all images in a single directory tree that you can add via addPassThroughCopy.

I think the solution here is likely that the permalink command needs to be more well defined in its behavior.

It should or should not behave according to template processing behavior (which copies all matching templateFormats to dest.

It would also be nice to specify it should be a copy vs a transform vs both. For example, the blog I'm migrating is y-m-d-title permalinks, but perhaps i want those old posts to now be available at both /y/m/d/title and just /title..

@nhoizey
Copy link
Contributor

nhoizey commented May 1, 2020

Looks like an Eleventy feature request, more than a specific eleventy-base-blog one.

Maybe we could move the discussion to the similar issue here: 11ty/eleventy#1140

@autonome
Copy link
Author

autonome commented May 1, 2020

Yes, that's the right place, thanks @nhoizey. Closing this one as it's not specific to the base blog example!

@autonome autonome closed this as completed May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants