Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

global key #36

Open
ninjasort opened this issue Nov 6, 2016 · 1 comment
Open

global key #36

ninjasort opened this issue Nov 6, 2016 · 1 comment

Comments

@ninjasort
Copy link

Currently, one needs to create a file for each piece of content they want to render.

Create files based on the files defined in your source folder

This somewhat defeats the purpose of using Contentful to store content. There still remains a dependency on local files within a Metalsmith project src. I think this could be handled easier by eliminating the need for src files completely and specifying key and layout properties that get transformed into files. For example, by specifying a {"useKey": "_key"} a user could create a _key property within their contentful backend with the path to the file. { "_key": "projects/my-project.md" }, this could then be transformed into a file, remove the _key property and add all data onto that file object using the key as the filename and adding the other properties to the object with contents being transformed to a buffer.

{
  "projects/my-project.md": {
    "title": "My Project",
    "layout": "project.liquid",
    "contents": "<Buffer>",
    "other_contentful_property": ""
  }
}

This way files can be used in other plugins like metalsmith-layouts and metalsmith-permalinks. It would all be part of the pipeline at that point.

@stefanjudis
Copy link
Contributor

@cameronroe jup. :) Agree that would be a nice improvement.

Not sure when I'll be able to tackle it. Contributions are welcome. :)

ninjasort pushed a commit to ninjasort/contentful-metalsmith that referenced this issue Nov 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants