Closed bzerangue closed 6 years ago
@bzerangue currently implementing Hugo and I came across the same issue. I was already wonder how others would render a partial if you don't know the contenttype
directory. Anyways, since we needed this I decided to fix this.
Besides me spending some time figuring out how Go works.... the main challenge is that Contentful does not expose the ContentType in the sys
reference fields in their API:
"sys": {
"type": "Link",
"linkType": "Entry",
"id": "3hzaoKf49QakqgccMkyWbi"
}
Since it does not exist in the API response, it is not (automatically) included in the generated markdown files.
To solve this, I first go over all Entries to link all Entry IDs to their ContentType, after that, I provide that information to the function that writes the reference so it can include the lower case content type and create references like programming/3op5VIqGZiwoe06c8IQIMO.md
@adriaandejonge would be great if you can review and merge this, see pull request #33
On reference fields, it only lists the filename.md in the front matter.
Example...
And that causes a problem if you are refererring to multiple content types. Would it be possible to add the folder of the content type along with the filename in the the reference field, like so???
As a guy who is very Golang illiterate, this looks like the place you are defining this frontmatter? https://github.com/adriaandejonge/contentful-hugo/blob/7ab0c690f2a5a78beba76d6c2d798bbb0120c04a/translate/translate.go#L103
Could you point in the direction to adding the directory of the content types?