mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 12:09:02 +01:00
docs(guide): document exporting for web publishing
This commit is contained in:
parent
0bc86d7c75
commit
1d6ab64ae5
2
apps/server/src/assets/doc_notes/en/User Guide/!!!meta.json
generated
vendored
2
apps/server/src/assets/doc_notes/en/User Guide/!!!meta.json
generated
vendored
File diff suppressed because one or more lines are too long
53
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing/Exporting HTML for web publish.html
generated
vendored
Normal file
53
apps/server/src/assets/doc_notes/en/User Guide/User Guide/Advanced Usage/Sharing/Exporting HTML for web publish.html
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
<p>As described in <a class="reference-link" href="#root/pOsGYCXsbNQG/tC7s2alapj8V/_help_R9pX4DGra2Vt">Sharing</a>,
|
||||
Trilium can act as a public server in which the shared notes are displayed
|
||||
in read-only mode. While this can work in most cases, it's generally not
|
||||
meant for high-traffic websites and since it's running on a Node.js server
|
||||
it can be potentially exploited.</p>
|
||||
<p>Another alternative is to generate static HTML files (just like other
|
||||
static site generators such as <a href="https://www.mkdocs.org/">MkDocs</a>).
|
||||
Since the normal HTML ZIP export does not contain any styling or additional
|
||||
functionality, Trilium provides a way to export the same layout and style
|
||||
as the <a class="reference-link" href="#root/pOsGYCXsbNQG/tC7s2alapj8V/_help_R9pX4DGra2Vt">Sharing</a> function
|
||||
into static HTML files.</p>
|
||||
<p>Apart from the enhanced security, these HTML files are also easy to deploy
|
||||
on “serverless” deployments such as GitHub Pages or CloudFlare Pages and
|
||||
cache very easily.</p>
|
||||
<aside class="admonition tip">
|
||||
<p>Trilium's documentation, available at <a href="https://docs.triliumnotes.org/">docs.triliumnotes.org</a> is
|
||||
built using this function of exporting to static HTML files which are then
|
||||
deployed automatically to CloudFlare Pages.</p>
|
||||
<p>The process is <a href="https://github.com/TriliumNext/Trilium/blob/main/apps/edit-docs/src/build-docs.ts">automated</a> by
|
||||
importing the Markdown documentation and exporting it via a script to the
|
||||
static web format.</p>
|
||||
</aside>
|
||||
<h2>Differences from normal sharing and export</h2>
|
||||
<p>Apart from normal <a class="reference-link" href="#root/pOsGYCXsbNQG/tC7s2alapj8V/_help_R9pX4DGra2Vt">Sharing</a>,
|
||||
exporting to static HTML files comes with a few subtle differences:</p>
|
||||
<ul>
|
||||
<li data-list-item-id="e9e5a7d50e33698fb322f4dc65108f3a9">The URL structure is different. Where in normal sharing it's something
|
||||
along the way of <code>example.com/share/noteid</code>, the notes follow
|
||||
an hierarchical structure, such as <code>docs.triliumnotes.org/user-guide/concepts/navigation/tree-concepts</code>.</li>
|
||||
<li
|
||||
data-list-item-id="e3995e60b9751ea177ac920a901635d4b">The <code>favicon.ico</code> is not handled automatically, it needs to be
|
||||
manually added on the server after the export is generated.</li>
|
||||
<li data-list-item-id="e72c2a986808ce27eb3bb5001fe4710cb">The “Last updated” for notes is not available.</li>
|
||||
</ul>
|
||||
<h2>Differences from normal .zip export</h2>
|
||||
<ul>
|
||||
<li data-list-item-id="e8a16c7135d6f6c4de3bc448bd8795289">The name of the files/URLs will prefer <code>shareAlias</code> to allow
|
||||
for clean URLs.</li>
|
||||
<li data-list-item-id="ef8bfdfc599c07ba70fbb4be97a3e26ab">The export requires a functional web server as the pages will not render
|
||||
properly if accessed locally via a web browser due to the use of module
|
||||
scripts.</li>
|
||||
</ul>
|
||||
<h2>Testing locally</h2>
|
||||
<p>As mentioned previously, the exported static pages require a website to
|
||||
function. In order to test locally, a web server needs to be used.</p>
|
||||
<p>One example is to use the Node.js-based <a href="https://www.npmjs.com/package/http-server"><code>http-server</code></a> which
|
||||
can be installed via:</p><pre><code class="language-text-x-trilium-auto">npm i -g http-server</code></pre>
|
||||
<p>Once installed simply:</p>
|
||||
<ol>
|
||||
<li data-list-item-id="ebc8d02c8cdcdb030c746f1fd5eccb5bd">Extract the exported .zip file.</li>
|
||||
<li data-list-item-id="e1d20f408fb89d0af0c1003984373f808">Inside the extracted directory, run <code>http-server</code>.</li>
|
||||
<li data-list-item-id="ecf0c59f3a26c8e766bb1d739f8355e33">Access the indicated address (e.g. http://localhost:8080).</li>
|
||||
</ol>
|
||||
35
docs/User Guide/!!!meta.json
vendored
35
docs/User Guide/!!!meta.json
vendored
@ -11612,6 +11612,41 @@
|
||||
"dataFileName": "1_Serving directly the conte.png"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"isClone": false,
|
||||
"noteId": "ycBFjKrrwE9p",
|
||||
"notePath": [
|
||||
"pOsGYCXsbNQG",
|
||||
"tC7s2alapj8V",
|
||||
"R9pX4DGra2Vt",
|
||||
"ycBFjKrrwE9p"
|
||||
],
|
||||
"title": "Exporting HTML for web publishing",
|
||||
"notePosition": 20,
|
||||
"prefix": null,
|
||||
"isExpanded": false,
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "R9pX4DGra2Vt",
|
||||
"isInheritable": false,
|
||||
"position": 30
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"name": "iconClass",
|
||||
"value": "bx bxs-file-html",
|
||||
"isInheritable": false,
|
||||
"position": 40
|
||||
}
|
||||
],
|
||||
"format": "markdown",
|
||||
"dataFileName": "Exporting HTML for web publish.md",
|
||||
"attachments": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
40
docs/User Guide/User Guide/Advanced Usage/Sharing/Exporting HTML for web publish.md
vendored
Normal file
40
docs/User Guide/User Guide/Advanced Usage/Sharing/Exporting HTML for web publish.md
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# Exporting HTML for web publishing
|
||||
As described in <a class="reference-link" href="../Sharing.md">Sharing</a>, Trilium can act as a public server in which the shared notes are displayed in read-only mode. While this can work in most cases, it's generally not meant for high-traffic websites and since it's running on a Node.js server it can be potentially exploited.
|
||||
|
||||
Another alternative is to generate static HTML files (just like other static site generators such as [MkDocs](https://www.mkdocs.org/)). Since the normal HTML ZIP export does not contain any styling or additional functionality, Trilium provides a way to export the same layout and style as the <a class="reference-link" href="../Sharing.md">Sharing</a> function into static HTML files.
|
||||
|
||||
Apart from the enhanced security, these HTML files are also easy to deploy on “serverless” deployments such as GitHub Pages or CloudFlare Pages and cache very easily.
|
||||
|
||||
> [!TIP]
|
||||
> Trilium's documentation, available at [docs.triliumnotes.org](https://docs.triliumnotes.org/) is built using this function of exporting to static HTML files which are then deployed automatically to CloudFlare Pages.
|
||||
>
|
||||
> The process is [automated](https://github.com/TriliumNext/Trilium/blob/main/apps/edit-docs/src/build-docs.ts) by importing the Markdown documentation and exporting it via a script to the static web format.
|
||||
|
||||
## Differences from normal sharing and export
|
||||
|
||||
Apart from normal <a class="reference-link" href="../Sharing.md">Sharing</a>, exporting to static HTML files comes with a few subtle differences:
|
||||
|
||||
* The URL structure is different. Where in normal sharing it's something along the way of `example.com/share/noteid`, the notes follow an hierarchical structure, such as `docs.triliumnotes.org/user-guide/concepts/navigation/tree-concepts`.
|
||||
* The `favicon.ico` is not handled automatically, it needs to be manually added on the server after the export is generated.
|
||||
* The “Last updated” for notes is not available.
|
||||
|
||||
## Differences from normal .zip export
|
||||
|
||||
* The name of the files/URLs will prefer `shareAlias` to allow for clean URLs.
|
||||
* The export requires a functional web server as the pages will not render properly if accessed locally via a web browser due to the use of module scripts.
|
||||
|
||||
## Testing locally
|
||||
|
||||
As mentioned previously, the exported static pages require a website to function. In order to test locally, a web server needs to be used.
|
||||
|
||||
One example is to use the Node.js-based [`http-server`](https://www.npmjs.com/package/http-server) which can be installed via:
|
||||
|
||||
```
|
||||
npm i -g http-server
|
||||
```
|
||||
|
||||
Once installed simply:
|
||||
|
||||
1. Extract the exported .zip file.
|
||||
2. Inside the extracted directory, run `http-server`.
|
||||
3. Access the indicated address (e.g. http://localhost:8080).
|
||||
Loading…
x
Reference in New Issue
Block a user