> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allcodex.allmaker.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sharing Lore with Players

> Publish read-only player-facing wikis from your grimoire using share roots, alias slugs, basic auth, and the Portal public site or Core share endpoint.

AllCodex includes a powerful share rendering engine. You can publish a folder or branch of your lore tree as a public, read-only website for your players. Secret GM notes and draft content stay completely hidden.

There are two ways to serve a share:

* **Portal public site (recommended)** — the Portal hosts a branded, search-enabled public site at `/public/lore/[id]` on the domain configured by `NEXT_PUBLIC_PORTAL_URL`. The landing page (`/`) shows the configured share root, a list of published lore, and a search box.
* **Core share endpoint** — AllCodex Core also serves raw shared HTML at `http://your-core-ip:8080/share/noteId`. Use this if you don't run the Portal.

***

## Setting up a share subtree

To publish a section of your grimoire:

1. **Tag the share root**: Open the note or folder you want to share, open the share settings panel, and select **Set as share root**. This attaches the `#shareRoot` label and registers the note under `_share` in Core.
2. **Set the portal URL**: In your Portal deployment, set [`NEXT_PUBLIC_PORTAL_URL`](/self-hosting/configuration) to the public domain players will visit (for example, `https://wiki.example.com`).
3. **Share the link**: The share settings panel shows the computed URL — `${NEXT_PUBLIC_PORTAL_URL}/public/lore/<noteId-or-alias>`. Send that link to your players, or send them to the Portal root to browse and search.

***

## Share configuration labels

You can fine-tune how shared trees behave by adding these canonical labels to your notes:

| Label                             | Value           | Description                                                                                                           |
| :-------------------------------- | :-------------- | :-------------------------------------------------------------------------------------------------------------------- |
| **`#shareRoot`**                  | (none)          | Designates the selected note and all of its sub-notes as a public share.                                              |
| **`#shareAlias`**                 | `slug-string`   | Creates a custom, human-readable URL slug (e.g. `#shareAlias = "blackstone"` serves the note at `/share/blackstone`). |
| **`#shareCredentials`**           | `user:password` | Sets Basic HTTP Authentication. Visitors must enter this username and password to view the share.                     |
| **`#shareIndex`**                 | (none)          | Marks the selected note as the default home/landing page of the share.                                                |
| **`#shareHiddenFromTree`**        | (none)          | Keeps the note accessible via direct link, but hides it from the sidebar navigation tree.                             |
| **`#shareDisallowRobotIndexing`** | (none)          | Injects `noindex` headers to prevent Google and search engines from indexing your campaign wiki.                      |

<Tip>
  When you serve through the Portal, custom aliases work directly in the URL: a note labeled `#shareAlias=blackstone` is reachable at `/public/lore/blackstone` as well as `/public/lore/<noteId>`.
</Tip>

***

## Hiding secret GM content

Mix player-safe lore and GM secrets in the same notes using two gating mechanisms:

### Note-level gates

* **`#draft` tag**: Notes with this tag are hidden from public share navigation, even when placed inside a shared folder.
* **`#gmOnly` tag**: Notes with this tag return a `404 Not Found` error to public visitors, keeping secrets secure.

### Section-level gates (HTML classes)

Gate individual paragraphs, lists, or tables to show general descriptions while hiding specific spoilers:

* Wrap secrets in a container with the CSS class **`.gm-only`**.
* The Core share renderer parses note HTML at output time and **strips elements containing the `.gm-only` class** before sending the page to public visitors.

```html theme={null}
<p>Commander Vane is a legendary general.</p>

<!-- This block is stripped from player views: -->
<div class="gm-only">
  <p><strong>GM Spoiler:</strong> Vane is secretly a vampire lord working for the Lich.</p>
</div>
```
