> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 模板管理

> 将项目发布为模板，更新模板，编辑其详细信息并删除模板。

你可以在编辑器中发布模板，并在模板库中的模板页面或管理面板中管理模板。

> [!NOTE]
>
> 要开启模板库、选择其分类或允许非管理员用户发布模板，请参阅[模板](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/configuration/overleaf-toolkit/templates.md)。

## 发布项目

**1. 编译项目**

打开项目并点击 **Recompile**。你看到的 PDF 就是模板库将显示的 PDF。

当编辑器中没有 PDF 时，例如打开一个无法编译的项目时，**Manage Template** 会显示为灰色。

![File 菜单中 Manage Template 显示为灰色，旁边是 No PDF 提示](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-no-pdf.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=4936daf821ae290a1fdbd4bd554b8b57)

还没有 PDF，因此无法发布

> [!WARNING]
>
> 发布会保存文件的当前状态，以及最后一次成功编译生成的 PDF。如果你在那次编译之后编辑了项目，或者最后一次编译失败，模板库会在较新的文件旁显示旧的 PDF，而这些文件可能无法编译。请反复编译直到 PDF 正确，然后再发布。

**2. 打开表单**

在编辑器的顶部菜单中，点击 **File**，然后点击 **Manage Template**。

![包含 Manage Template 的 File 菜单](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-file-menu.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=d0dbe9ae74e4aa062ad0648bdff1d8d0)

File 菜单

**3. 填写表单**

![已填写的 Manage Template 对话框，作者为 Markdown 链接，描述中使用了 Markdown](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-publish-form.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=6588cacfcde7488276b15ea6533736b6)

Manage Template 对话框

| 字段 | 说明 |
| - | - |
| **Title** | 默认为项目名称。在模板库中必须唯一。最多 150 个字符。 |
| **Author** | 默认为你的名字。像 `[Demo Author](https://example.com)` 这样的 Markdown 链接会在模板页面上显示为链接。 |
| **Categories** | 一个分类，请参阅[分类](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/user-guide/administrators/template-management.md#categories)。 |
| **Description** | 支持 Markdown。最多 4096 个字符。模板页面将其显示为 **Abstract**，模板库以纯文本显示其开头部分。 |
| **License** | **Creative Commons CC BY 4.0**、**LaTeX Project Public License 1.3c** 或 **Other (as stated in the work)**。 |

项目的编译器和主文档会随模板一起保存，因此请先在项目中设置好它们。从模板打开的项目会使用相同的设置。

**4. 点击 Publish**

模板页面随即打开。

![模板页面，包含 Open as Template、View PDF 和下载按钮、详细信息，以及 Admin: Source Project、Edit 和 Delete](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-template-page.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=5cd9fa2ac828a55f2b63737d55ff35e8)

新模板

**Admin: Source Project**、**Edit** 和 **Delete** 只对你显示。其他用户只能看到 **Open as Template**、**View PDF** 和下载按钮。

**5. 检查模板库**

点击右上角的 **Templates**。新模板位于列表的第一位。

## 分类

一个模板属于一个分类。分类的名称和描述来自你的[配置](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/configuration/overleaf-toolkit/templates.md#configuration)，无法在站点中修改。

你会在以下位置看到分类：

* 表单中的 **Categories**。
* 模板库页面 `/templates` 顶部的卡片。在 **All templates** 页面点击 **Template Gallery** 即可进入。
* 每个分类各自的页面，例如 `/templates/presentation`。没有模板的分类会显示 **No Templates.**
* 项目页面上的 **New project**，然后是 **More templates**。
* 模板页面标题上方的链接。

![模板库页面，包含 Journal articles、Books 和 Presentations 卡片](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-categories.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=c3ca7290d56846fcd3b6168d74f31589)

模板库页面上的分类

表单中的 **All templates** 表示没有自己的分类：该模板只出现在完整列表中。

## 更新模板

要更改文件和 PDF，请以相同的标题再次发布项目。

**1. 修改项目**

编辑项目并点击 **Recompile**。

**2. 再次发布**

点击 **File**，然后点击 **Manage Template**。表单会显示模板的详细信息，你可以修改它们。点击 **Publish**。

会出现一条提示，说明该标题已存在，按钮变为 **Overwrite**。

![Manage Template 对话框，显示提示 A template with this title already exists 和 Overwrite 按钮](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-overwrite.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=ad215f871bfb5b4940297b6569ef4c4b)

以相同标题发布

如果此时修改了 **Title**，提示会消失，**Publish** 会创建一个新模板。

**3. 点击 Overwrite**

同一个模板页面会打开，并显示新的 PDF。

![模板页面，其预览现在显示文档的新标题](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-overwritten.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=7d862a0455bef693f5945b2027e1d6dd)

已更新的模板

用户已经从该模板打开的项目不会改变。

> [!WARNING]
>
> 表单通过项目名称查找模板。如果你用 **Edit** 重命名了模板，表单打开时会显示项目名称、你的名字、第一个分类和空的描述，并且输入模板标题也无法恢复其详细信息。此时 **Overwrite** 会用表单中的内容替换详细信息，因此请先重新填写。

## 编辑详细信息

这会更改模板库中显示的模板信息，而不会更改其文件或 PDF。

**1. 打开模板**

点击右上角的 **Templates**，点击模板，然后点击 **Edit**。

**2. 修改字段**

字段与发布时相同，另外多了一个：**Language** 是从该模板打开的项目的拼写检查语言。对于以默认语言发布的项目，它显示 **Off**，从中打开的项目使用 **English (American)**。

![Edit template 对话框，包含 Title、Author、Categories、Description、License 和 Language](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-edit.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=c8909cecc8735f0e98a08df2b6d44ad9)

Edit template 对话框

与其他模板相同的标题会被拒绝：在你修改 **Title** 之前，**Save** 一直显示为灰色。

**3. 点击 Save**

对话框关闭，模板页面显示新的详细信息。

## 源项目

**Admin: Source Project** 会打开发布该模板的项目。

模板保存了自己的文件副本。如果你永久删除了该项目，此按钮会消失，用户仍然可以打开模板。仅位于 **Trash** 中的项目会保留此按钮。另请参阅[模板](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/configuration/overleaf-toolkit/templates.md)下的问答。

## 删除模板

**1. 点击 Delete**

在模板页面上，点击 **Delete**。对话框会显示模板的名称。

![带有 Confirm 按钮的 Delete template 对话框](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-delete.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=105ea36d23b90f08cda2f5c8831d6c2d)

Delete template 对话框

**2. 点击 Confirm**

你会回到之前所在的页面，该模板不再出现在模板库中。其链接现在显示 **Not found**。

源项目会保留，用户从该模板打开的项目也会保留。

## 在管理面板中管理模板

点击 **Admin**，然后点击 **Project/Object Lookup**，再点击 **Templates** 选项卡。它列出所有模板及其作者和所有者，并且可以搜索。

![管理面板的 Templates 选项卡，显示每个模板的标题、作者、所有者和最后修改日期](https://mintcdn.com/ayakaleaf-pro/PeD9iteXIf8j4GXw/images/on-premises/templates-admin-panel-tab.png?fit=max\&auto=format\&n=PeD9iteXIf8j4GXw\&q=85\&s=141883e946dda193d3a1b5534602b18e)

管理面板中的所有模板

* 点击标题打开模板页面，或点击打开图标在新标签页中打开。
* 点击所有者打开该用户的页面。
* 点击垃圾桶图标，然后点击 **Delete** 删除模板。对话框会警告此操作无法撤销，模板将从模板库中移除。

## 发布被拒绝时

表单允许你输入超过站点所接受的内容。**Title** 超过 150 个字符时显示 `Template title exceeds the maximum length of 150 characters.`，**Description** 超过 4096 个字符时显示 `Template description exceeds the maximum length of 4096 characters.`

此后即使你缩短了文本，**Publish** 仍然显示为灰色。点击 **Cancel**，再点击 **File**，然后点击 **Manage Template**，重新填写表单。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.