Single copy of TreeNode for table of contents
Question asked by Marc Johnston - 2/16/2023 at 1:26 PM
I know HTML doesn't offer an <include> ... but my project generates a 60GB html site.  I can't even push it into GitHub.  Is there an option for to only generate one TreeNode and then included that treenode on each page? The TreeNode is over 17k lines of HTML (1.08MB) and with 55k html files, 59.6GB of my 60GB is that TreeNode.  I see aspx search, so maybe we can use ASP include?

5 Replies

Reply to Thread
Serge B. Replied
Employee Post

What version of GhostDoc you are using and what theme?

Serge Baranovsky
SubMain Software
(800) 936-2134
Marc Johnston Replied
The Trial GhostDoc Pro 2022.2.22190

I don't know anything about "Theme"

Marc Johnston Replied
So I've looked into various options ... nothing really seems perfect or great yet.  

1. XMLHttpRequest - CORS violation

2. Object - Maybe ... might need more investigation
<object type="text/html" data="urltofile.html"></object

3. Link Import - Not supported (due to CORS)
<link rel="import" href="/path/to/file.html">

4. Pure Javascript - WORKING (not much testing yet though)

Bold is where we add
Underline is existing HTML from GhostDoc
Intalic is content copied from TOC

Here is the treenode.js file ... 
              <div class="TreeNode"> 
... all of the TOC here

Then we replace the TOC in all of the *.html files with a <script>
            <div class="Tree" id="divTree" onselectstart="javascript: return false;">
<script src="treenode.js"></script>

Marc Johnston Replied
I would ask that there is an option to select the "type" of include ... a.) direct paste (what GhostDoc is using now ... default to this) b.) Pure Javascript (maybe what is shown above) c.) ASP server side include (rendering via disk will show blank though)
Marc Johnston Replied
The pure javascript is working nicely because GhostDoc isn't using any backquote characters in the TOC ... so the document.write wrapping the entire file with backquote characters is working.

Reply to Thread