forkjo/templates
Xavier Vello 147ae2c5be Fix opengraph meta for wiki pages (#4427)
Fixes https://codeberg.org/forgejo/forgejo/issues/4417 by adding a conditional branch to the `head_opengraph` template to match wiki pages. I tried to be consistent with the other types:

- `og:title` is the wiki page title
- `og:url` is built via `{{AppUrl}}{{.Link}}` like it is done for commit and file views. This has the caveat of doubling the slash (see test below). Should we `{{trimSuffix "/" AppUrl}}` to remove this, if sprig is available?
- `og:description` is the repository description to match GH behaviour. Also, the first sentences of the page might not be descriptive enough. Should we prefix the repo description with the repo name?
- `og:type` and `og:image` are common

Added a `TestOpenGraphProperties` integration test using existing fixtures. Coverage is not 100% but can be improved later.

## Output on a test repo

```html
<meta property="og:title" content="Project architecture">
<meta property="og:url" content="http://localhost:3000//xvello/wiki-test/wiki/Project-architecture">
<meta property="og:description" content="description for a test project">
<meta property="og:type" content="object">
<meta property="og:image" content="http://localhost:3000/avatars/3dd4d1e4eef065d1b4ad4bdb081ab6e7">
```

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4427
Co-authored-by: Xavier Vello <xavier.vello@gmail.com>
Co-committed-by: Xavier Vello <xavier.vello@gmail.com>
2024-07-10 18:29:35 +00:00
..
admin Add cache test for admins (#31265) 2024-06-23 11:27:03 +02:00
api/packages/pypi Update templates/api/packages/pypi/simple.tmpl 2024-04-12 16:43:30 +00:00
base Fix opengraph meta for wiki pages (#4427) 2024-07-10 18:29:35 +00:00
custom [FEAT] Repository flags 2024-02-05 16:09:42 +01:00
devtest Fix some URLs whose sub-path is missing (#31289) 2024-06-09 16:04:57 +02:00
explore [I18N] Injected updated time in translation string (#3837) 2024-05-20 18:47:35 +00:00
mail Remove title from email heads (#3810) 2024-05-17 10:10:33 +00:00
org [BUG] Fix mobile UI for organisation creation 2024-07-07 01:37:38 +02:00
package Extract and display readme and comments for Composer packages (#30927) 2024-06-16 13:42:59 +02:00
projects Merge pull request 'Replace gt-word-break with tw-break-anywhere' (#4102) from 0ko/forgejo:ui-replace-gt-word-break into forgejo 2024-06-11 10:39:03 +00:00
repo accessibility: anchor elements' missing href added (#4375) 2024-07-08 17:32:59 +00:00
shared fix(code search): various ui/ux improvements raised by user research (#4332) 2024-07-10 05:25:32 +00:00
status Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
swagger Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00
user Merge pull request 'Make user privacy settings more clear' (#4439) from 0ko/forgejo:ui-settings-activity into forgejo 2024-07-10 06:09:52 +00:00
webhook webhook: matrix access_token helper text 2024-04-16 08:59:56 +02:00
home.tmpl Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
install.tmpl A few cosmetic improvements to the installation page (#4170) 2024-06-18 09:49:56 +00:00
post-install.tmpl [BRANDING] Custom loading animation for Forgejo 2024-02-05 16:02:13 +01:00