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

New Publish API #455

Merged
merged 12 commits into from
Oct 19, 2017
Merged

New Publish API #455

merged 12 commits into from
Oct 19, 2017

Conversation

jonwinton
Copy link
Contributor

Summary

Adds two options to a site's controller around publishing:

  • resolvePublishUrl: An Array of functions that will be used in a Promise Chain. One of the functions should return a url that the page should be published to.

  • modifyPublishedData: An Array of functions that are reduced through after a page's url has been determined, this allows you to modify the page data before publishing is complete.

Example

module.exports.resolvePublishUrl = [
    // canonical URL
    (uri, data, locals) => publishing.getCanonicalUrl(data, locals, mainComponentRefs),
    // evergreen articles
    (uri, data, locals) => publishing.getSlugUrl(data, locals, mainComponentRefs),
    // regular dated articles
    (uri, data, locals) => publishing.getYearMonthSlugUrl(data, locals, mainComponentRefs)
];

module.exports.modifyPublishedData = [
  publishing.addLastModified
];

Other Minor Changes

  • Fixed a test in bootstrapping file
  • Added some deprecation notices for unneeded methods being exported
  • Adds package-lock.json for dev in Node 8

@jonwinton jonwinton merged commit 1435009 into master Oct 19, 2017
@jonwinton jonwinton deleted the pub-update branch October 19, 2017 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants