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

global key #36

@ninjasort

Description

@ninjasort

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions