title: Put the URL (prepended with the text "Parent_") for a particular Google Doc into that Google Doc's own header and footer
body: <h2>Overview</h2>
  <p>Essentially I want to be able to migrate my Google Docs to a <strong>regular website</strong> while maintaining the links I had created between my Google Docs.</p>
  <h2>A proposed solution</h2>
  <p>What do you think about having a Google Apps Script put the URL (prepended with the text &quot;Parent_&quot;) for a particular Google Doc into that Google Doc's own header and footer, once and only once, when that Google Doc is initially created? (I almost never use headers and footers therefore it seems like it might be reasonable to use them as if they were akin to fields in a database).</p>
  <p>For example,</p>
  <ol>
  <li><p>Create a Google Doc.</p>
  </li>
  <li><p>Let's say, that Google Doc, has the following URL <a href="https://docs.google.com/document/d/1XwCyQ2MAIJgcLwfmR9-_JQq97H9iVLbGXNbpbzq1-Oo/" rel="nofollow noreferrer">https://docs.google.com/document/d/1XwCyQ2MAIJgcLwfmR9-_JQq97H9iVLbGXNbpbzq1-Oo/</a></p>
  </li>
  <li><p>Put Parent_<a href="https://docs.google.com/document/d/1XwCyQ2MAIJgcLwfmR9-_JQq97H9iVLbGXNbpbzq1-Oo/" rel="nofollow noreferrer">https://docs.google.com/document/d/1XwCyQ2MAIJgcLwfmR9-_JQq97H9iVLbGXNbpbzq1-Oo/</a> into the header and footer.</p>
  </li>
  </ol>
  <p>That way when a Google Doc is exported as an HTML document, it will contain 2 instances of the following string: Parent_<a href="https://docs.google.com/document/d/1XwCyQ2MAIJgcLwfmR9-_JQq97H9iVLbGXNbpbzq1-Oo/" rel="nofollow noreferrer">https://docs.google.com/document/d/1XwCyQ2MAIJgcLwfmR9-_JQq97H9iVLbGXNbpbzq1-Oo/</a> into the header and footer</p>
  <p>Then, with a simple find/replace (RegEx) the HTML files could be relinked.</p>
  <p>To be safe, I might run a Google Apps Script once a week to confirm that each Google Doc contained two instances of &quot;Parent_&quot;  followed by the URL.</p>
  <p>Finally, what if, say, once a week I were to export my Google Doc's as HTML files, upload them to a regular website, and run, say, a Python script to ensure that every Google Doc that contained &quot;URL001&quot; that was not prepended with &quot;Parent_&quot; actually linked to &quot;Parent_URL001&quot;</p>
  <p>Fundamentally, it's a kludge. I know that. But I'm trying to circumvent, what is effectively, a &quot;soft lock-in&quot; feature in Google Docs for those who create hyperlinks between Google Docs.</p>
  <h2>My problem described in detail</h2>
  <p>Frequently I link one Google Doc to another Google Doc. As a result, I have created something that is similar to a wiki. For example let’s suppose I had created two Google Docs: Google Doc #1 and Google Doc #2.</p>
  <p>Subsequently let’s suppose I had created a link (a hyperlink) in Google Doc #1 to Google Doc #2. Of course that's an extremely simple example. Let’s make it more complex. Imagine I had created a couple of thousand Google Docs with many links (hyperlinks) between them.</p>
  <p>Of course backing up those Google Docs would be trivial either by using Google Takeout or rsync. However, what would happen if I wanted to move those Google Docs to a <strong>regular website</strong>? Then the myriad hyperlinks I had created would fail to point to the documents on my regular website.</p>
  <p>That is, on my regular website, if I were to click on the link on the page which contained the contents which had been contained in Google Doc #1 (https://my_regular_website.com/google_<strong>doc_001</strong>) then instead of opening a link on my regular website to the page which contained the contents which had been contained in Google Doc #2 (https://my_regular_website.com/google_<strong>doc_002</strong>) , the link would point to the original Google Doc #2 (<a href="https://drive.google.com/drive/folders/google_**doc_002" rel="nofollow noreferrer">https://drive.google.com/drive/folders/google_**doc_002</a>**)</p>
  <h2>Why not use Notion or at least a wiki?</h2>
  <p>I like using Google Docs as a word processor. Sometimes I use Google Docs to write essays. Sometimes I use Google Docs to create documentation. Sometimes I use Google Docs to collaborate with others (instead of emailing). Furthermore, I often use Google Docs’ outline format, styles, and voice typing.</p>
  <p>As far as I know, neither Notion nor any  wiki have all of the features listed above.</p>