decaporg / decaporg/decap-cms

Calling getCollection from a preview template should expose the slugs

Open
#7,435 0 comments 0 reactions 0 assignees View on GitHub
type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

Currently, when calling `getCollection()` inside a preview template, only the data of the items is returned. In order to be useful, the returned Map should also include the path & slug.

Since the function already returns a Map (with just a single `data` key), adding path and slug is trivial and would be a non-breaking change.

I'll submit a PR for this.

Contributor guide

Open the contributing guide

Research direction

Start by locating getCollection in the preview-template implementation and inspect where its returned Map is assembled. Confirm the current data-only shape, then verify that each returned item exposes its path and slug without breaking existing consumers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.