Skip to content

Don't mangle existing template routes. #41

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

Merged
merged 1 commit into from
Sep 28, 2015
Merged
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
12 changes: 8 additions & 4 deletions src/utils/ContentRepositoryUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ function interpretMaps(deconstConfig, contentMap, routesMap) {
}
}

// Ensure that the template route map contains, at least, the site that we're rendering.
if (! templateRoutes[site]) {
templateRoutes[site] = {routes: {}};
}

return {contentIDBase, site, prefix, templateRoutes, isMapped};
};

Expand Down Expand Up @@ -256,7 +261,8 @@ export class ContentRepository {

// Inject the template selection if necessary.
if (!this.isMapped && this.template) {
this.templateRoutes[`^${this.prefix}.*`] = this.template;
this.templateRoutes[this.site] = {routes: {}}
this.templateRoutes[this.site].routes[`^${this.prefix}.*`] = this.template;
}
}

Expand Down Expand Up @@ -382,9 +388,7 @@ export default {
contentMap[repo.site].content[repo.prefix] = repo.contentIDBase;
contentMap[repo.site].proxy["/__local_asset__/"] = "http://content:8080/assets/";

let templateRoutes = {};
templateRoutes[repo.site] = {};
templateRoutes[repo.site].routes = repo.templateRoutes;
let templateRoutes = repo.templateRoutes;

let controlOverrideDir = path.join(osenv.home(), '.deconst', 'control-' + repo.id);
let mapOverridePath = path.join(controlOverrideDir, 'content.json');
Expand Down