 
         # 3. insert doc articles
         ( $docs = $ "#wrapper div.docs" ).empty()
-        for sChapterName in aChapters
+        for sChapterName in index.chapters
             ( $chapterTitle = $ "<h2></h2>" ).text sChapterName
             $docs.append $chapterTitle
-            for sTopicName, sContent of oDocChapters[ sChapterName ]
+            for sTopicName in index[ sChapterName ]
                 ( $topicArticle = $ "<article></article>" )
                     .attr( "id", sTopicName )
-                    .html( sContent )
+                    .html( oDocChapters[ sChapterName ][ sTopicName ] )
                 $docs.append $topicArticle
 
         # 4. update version number


    grunt.registerTask "generate", "Generate Kouto Swiss documentation page.", ->
        sDocFilePath = "docs/docs.html"
        aChapters = [ "reset", "functions", "utilities", "grid" ]
        oDocChapters = {}
        iChapters = 0
        iTopics = 0
        # 1. get all the markdown doc files
        grunt.file.recurse "./_docs", ( sAbsolutePath, sRootDir, sSubDir, sFilename ) ->

        classPrefix: ""

pkg = require "../../package.json"
index = require "../index.json"

oMarkdownCompilationOptions =
    gfm: yes
