index-page.js 994 B

123456789101112131415161718192021222324252627
  1. module.exports = function indexPage(renderDocsProcessor) {
  2. return {
  3. name: 'index-page',
  4. description: 'Create documentation index page',
  5. $runAfter: ['adding-extra-docs'],
  6. $runBefore: ['extra-docs-added'],
  7. $process: function(docs) {
  8. //TODO(tlancina): move versionData into its own service
  9. var versionData = renderDocsProcessor.extraData.version;
  10. var currentVersion = versionData.current.name;
  11. var latestVersion = versionData.latest.name;
  12. // var versionPath = currentVersion == 'nightly' ? '' : currentVersion;
  13. // If latest and not initial build, set path to docs root
  14. var versionPath = (currentVersion == latestVersion) && !versionData.initialVersionBuild ? '' : currentVersion;
  15. docs.push({
  16. docType: 'index-page',
  17. id: 'index-page',
  18. currentVersion: currentVersion,
  19. template: 'api_index.template.html',
  20. outputPath: 'content/docs/' + versionPath + '/api/index.md'
  21. });
  22. }
  23. }
  24. };