0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-27 18:32:37 -05:00
forgejo-docs/docs/user/wiki.md

113 lines
4.4 KiB
Markdown
Raw Normal View History

2023-03-07 03:40:11 -05:00
---
2023-03-07 03:44:03 -05:00
title: 'Integrated Wiki'
license: 'CC-BY-SA-4.0'
origin_url: 'https://codeberg.org/Codeberg/Documentation/src/commit/85d333f48badb27f8e4371263db3354f70836dfd/content/getting-started/wiki.md'
2023-03-07 03:40:11 -05:00
---
A [wiki](https://en.wikipedia.org/wiki/Wiki) is a collaborative space on the web. It is a common practice to use wikis to collect knowledge and share information.
2024-05-25 22:19:35 -04:00
Codeberg allows you to add a wiki to a repository for additional documentation.
2023-03-07 03:40:11 -05:00
The user in these examples is `knut`, the polar bear and its repository is `foobar`.
## Activation and Permissions
2023-03-07 03:40:11 -05:00
To enable the wiki for a repository, visit the `Settings` page and activate `Enable Repository Wiki` in the `Advanced Section`. It will default to the built-in wiki which is described here, but you can add an URI to an external site the "Wiki" tab should link to.
> **Warning**
> Be aware that the wiki, once enabled, is accessible for _everyone_ who has `read` access to your repository - on public repositories even unauthenticated guests can access the wiki.
> The wiki is _not_ a suitable place for storing private information or secrets (like passwords).
>
> Activating the `Allow anyone to edit the Wiki` option in `Settings` will give everyone with an account write access to the wiki.
2023-03-07 03:40:11 -05:00
To edit the wiki `write` permission to the repository is required, unless the `Allow anyone to edit the Wiki` setting is activated on the `Settings` page, in the `Advanced Settings` section.
2023-03-07 03:40:11 -05:00
## Wiki structure
2024-05-25 22:19:35 -04:00
The wiki is essentially a separate Git repository in your repository with a predefined name in the form of `<your-repository-name>.wiki.git`.
2023-03-07 03:40:11 -05:00
It consists of [Markdown](https://en.wikipedia.org/wiki/Markdown) files (file extension `.md`) and additional assets like images.
2023-03-07 03:44:03 -05:00
No further stylesheets are needed. The Markdown files are automatically rendered according to the selected Forgejo theme.
2023-03-07 03:40:11 -05:00
## Adding content via web
2023-03-07 03:40:11 -05:00
After you have enabled the wiki you are prompted to create the initial page `Home.md`.
The web UI in your browser is currently limited to adding, updating, and deleting pages; you can't manage assets like images this way.
2023-03-07 03:44:03 -05:00
![Wiki home page with edit buttons](../_images/user/wiki/wiki_pageview.png)
2023-03-07 03:40:11 -05:00
Clicking on the "Insert Image" button will make the following text appear in your text editor: `![](https://)`
## Adding content using a local Git client
2024-05-25 22:19:35 -04:00
You can work with the wiki repository as you would with any other Git repository on Forgejo.
2023-03-07 03:40:11 -05:00
```shell
git clone git@codeberg.org:knut/foobar.wiki.git
cd foobar.wiki
nano Home.md # or your editor of choice
git commit -am "create Home page"
```
Editing locally allows you to use your favorite editor (preferably with Markdown syntax check and highlighting) and manage additional assets like images.
### Adding images using a local Git client
2023-03-07 03:40:11 -05:00
You can add images to the root directory or a specific subfolder (like `assets` or `images`) using your local Git client.
A feasible workflow might look like this:
```shell
# create a subfolder for images
mkdir images
cd images
# copy the image into this folder
git add images/image.png
git commit -m "add image"
git push
```
## Attaching images in Markdown documents
2023-03-07 03:40:11 -05:00
Now, you can reference the image in Markdown, like this:
**File in repository**:
2023-03-07 03:40:11 -05:00
```markdown
![image alt text](images/image.png 'image title')
2023-03-07 03:40:11 -05:00
```
**External image**:
```markdown
![image alt text](https://example.com/image.jpg 'image title')
```
When including images from Forgejo repositories, keep in mind that _you should use the raw version of the image._
2023-03-07 03:40:11 -05:00
After saving your changes, the image should be visible.
> In contrast to embedding external images, images in Git are only rendered after saving the wiki or Markdown file changes.
## Adding a sidebar and a footer
2023-03-07 03:40:11 -05:00
To enhance the usability of your wiki you can add a custom sidebar and a footer that are shown on every page. The sidebar will be displayed to the right of the main content and the footer below.
To enable the sidebar, just add a file named `_Sidebar.md` to your wiki. For a footer the file must be named `_Footer.md`.
Both file types allow common Markdown syntax to adjust the presentation to your needs.
Very basic example for a sidebar:
2023-03-07 03:40:11 -05:00
```markdown
- [[Home]]
### Content
refactor: use astro content collections for docs Reviewed-on: https://codeberg.org/forgejo/website/pulls/323 # Conflicts: # v1.19/admin/command-line.md # v1.19/admin/config-cheat-sheet.md # v1.19/admin/database-preparation.md # v1.19/admin/email-setup.md # v1.19/admin/incoming-email.md # v1.19/admin/index.md # v1.19/admin/logging-documentation.md # v1.19/admin/reverse-proxy.md # v1.19/admin/seek-assistance.md # v1.19/admin/upgrade.md # v1.19/developer/code-forgejo-org.md # v1.19/developer/index.md # v1.19/index.md # v1.19/license.md # v1.19/user/agit-support.md # v1.19/user/api-usage.md # v1.19/user/authentication.md # v1.19/user/email-settings.md # v1.19/user/first-repository.md # v1.19/user/index.md # v1.19/user/issue-pull-request-templates.md # v1.19/user/issue-tracking-basics.md # v1.19/user/labels.md # v1.19/user/linked-references.md # v1.19/user/merge-message-templates.md # v1.19/user/oauth2-provider.md # v1.19/user/packages/cargo.md # v1.19/user/packages/chef.md # v1.19/user/packages/composer.md # v1.19/user/packages/conan.md # v1.19/user/packages/conda.md # v1.19/user/packages/container.md # v1.19/user/packages/generic.md # v1.19/user/packages/helm.md # v1.19/user/packages/index.md # v1.19/user/packages/maven.md # v1.19/user/packages/npm.md # v1.19/user/packages/nuget.md # v1.19/user/packages/pub.md # v1.19/user/packages/pypi.md # v1.19/user/packages/rubygems.md # v1.19/user/packages/storage.md # v1.19/user/packages/vagrant.md # v1.19/user/project.md # v1.19/user/protection.md # v1.19/user/push-options.md # v1.19/user/push-to-create.md # v1.19/user/repo-permissions.md # v1.19/user/webhooks.md # v1.19/user/wiki.md # v1.20/user/semver.md
2023-07-26 18:20:30 -04:00
- [Page 1](./Page-1/)
2023-03-07 03:40:11 -05:00
> knuts wiki
```
> These files starting with `_` are hidden, so in the web UI you need to manually browse for the files. E.g. for our user _knut_ and his _foobar_ repo:
2023-03-07 03:40:11 -05:00
> `https://codeberg.org/knut/foobar/wiki/_Sidebar`