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

feat(scully): add contentType to contentFolderPlugin route data #320

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat(scully): add contentType to contentFolderPlugin route data
  • Loading branch information
cmgriffing committed Feb 23, 2020
commit 72fec784592f254d7e3745a98dcefa7237cbf15a
8 changes: 8 additions & 0 deletions scully/routerPlugins/contentFolderPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ async function addHandleRoutes(sourceFile, baseRoute, templateFile, conf, ext) {
templateFile,
data: {...meta, sourceFile},
};

// Add contentType value for filtering purposes
const contentFolderParts = conf.slug.folder.split('/');
const contentType = contentFolderParts[contentFolderParts.length - 1];
if (contentType) {
handledRoute.data.contentType = contentType;
}

handledRoutes.push(handledRoute);
if (!prePublished && Array.isArray(meta.slugs)) {
/** also add routes for all available slugs */
Expand Down