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

[gatsby-source-filesystem] createRemoteFileNode replaces original filename with hash #3132

Closed
nik-s opened this issue Dec 5, 2017 · 9 comments

Comments

@nik-s
Copy link

nik-s commented Dec 5, 2017

If files are downloaded through createRemoteFileNode the original filename is replaced by digest.

The problem is that if you download images you lose the descriptive filenames (a similar issue has already been fixed in gatsby-plugin-sharp #2752).

Would it be possible to append the original filename to digest? I know thatpath.parse(url).ext could be replaced with path.parse(url).base in gatsby-remote-file-node.js, however I'm not sure how this will work in cases such as #2985.

Thank you.

@calcsam
Copy link
Contributor

calcsam commented Dec 5, 2017

What's the use-case where you'd like the original image name to remain? Do you expect the user to download images?

@nik-s
Copy link
Author

nik-s commented Dec 5, 2017

As pointed out in #2306, descriptive image file names containing keywords are important for SEO.

Plugins such as gatsby-source-wordpress download media from remote sources using createRemoteFileNode (I see now that gatsby-source-wordpress is the only one working like that at the moment?).

Thanks!

@nik-s nik-s changed the title [gatsby-source-filesystem] createRemoteFileNode replaces original filename with digest [gatsby-source-filesystem] createRemoteFileNode replaces original filename with hash Jan 26, 2018
@ajayns
Copy link
Contributor

ajayns commented Mar 1, 2018

Is there any documentation describing how to use createRemoteFileNode and also about how it works? I wanted to know the best method to handle files and images from a headless CMS while working on a gatsby-source plugin. @calcsam @nik-s @KyleAMathews

@m-allanson
Copy link
Contributor

@ajayns It looks like the docs for createRemoteFileNode are currently a TODO. I'll open an issue for creating docs for this.

@ajayns
Copy link
Contributor

ajayns commented Mar 1, 2018

@m-allanson Could you brief me a bit about it then? That'd help me for now and maybe that;d help me come up with a PR.

@m-allanson
Copy link
Contributor

@ajayns I've put everything I know (which admittedly isn't that much) about createRemoteFileNode into #4302. Let me know if you've any specific questions and I'll see if I can help.

@ajayns
Copy link
Contributor

ajayns commented Mar 1, 2018

@m-allanson Okay that's great!

@KyleAMathews
Copy link
Contributor

Per the original request — we should keep the original name + a bit of hash at the end.

The hash is to differentiate between files named the same but from different places in the domain e.g. there could be a dozen files named avatar.jpg but which are all different.

@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

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

5 participants