Default "Home" text and content for JSDoc

Greg Pettit picture Greg Pettit · Jun 8, 2015 · Viewed 10k times · Source

After running a basic JSDoc compile/render from Node.js:

jsdoc file1.js file2.js

I get a well-formatted document using the default template inside a directory "out". Almost all is as expected!

But when opening the document, it always says "Home" on the index.html page, has no content on that initial page, and has "Home" in the sidebar navigation.

How and where do I notate the name of the project so that it replaces "Home"? I would also like to see a project description, as well as author and copyright information.

It seems like the most basic of things to do in a JSDoc, but I can't find the information! I have tried the following, based on some random article I found on the internet:

/** 
 * This JavaScript file contains foo bar baz...
 * 
 * @projectname Project Name
 * @version 0.1
 * @author Greg Pettit
 * @copyright 2015
 * 
 */

But I get no love.

[edited to add:]

Discovered the @file / @fileOverview / @overview (all synonyms) directive, which is somewhat helpful as I can now describe and set copyright/author information for each file:

/** 
 * @file Project description which renders below the individual filename and therefore isn't a real overview blurb.
 * 
 * @version 0.1
 * @author Greg Pettit
 * @copyright 2015
 * 
 */

That leaves 2 "problems" to solve still:

  1. An overview description; I think @file takes care of most of my needs, but since it's per-file, I would still like an "introduction" type paragraph or overview paragraph that appears before the descriptions of included files.

  2. Replacing that "Home" text with custom text

Answer

T.Chmelevskij picture T.Chmelevskij · Jun 9, 2015

Generate Home page

Create markdown file README.md

Generating jsdoc:

$ jsdoc path/to/js path/to/readme/README.md

To read more about this visit official documentation

Change 'Home' text

I don't think this is a proper way to do it but this works.

If you have jsdoc installed in your project find template file in your working directory, mine was:

./node_modules/jsdoc/templates/default/publish.js

Then search for 'Home' with search command and replace with your text, next step is to specify template when generating jsdoc:

 $ jsdoc ./src/scripts/ ./README.md -t node_modules/jsdoc/templates/default/