Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to "Hugo Relearn" theme #1501

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "page/themes/hugo-theme-learn"]
path = page/themes/hugo-theme-learn
url = https://github.com/matcornic/hugo-theme-learn
[submodule "page/themes/hugo-theme-relearn"]
path = page/themes/hugo-theme-relearn
url = https://github.com/McShelby/hugo-theme-relearn
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Only major versions are documented (e.g. Contao 4 and later on Contao 5).
## General rules

* Only use ATX style headlines (e.g. `# H1` or `### H3`).
* See [learn.netlify.app/en/cont/markdown/](https://learn.netlify.app/en/cont/markdown/)
and [learn.netlify.app/en/shortcodes/](https://learn.netlify.app/en/shortcodes/)
* See [mcshelby.github.io/hugo-theme-relearn/authoring/markdown/](https://mcshelby.github.io/hugo-theme-relearn/authoring/markdown/index.html)
and [mcshelby.github.io/hugo-theme-relearn/shortcodes/](https://mcshelby.github.io/hugo-theme-relearn/shortcodes/index.html)
for available markdown and shortcode syntax.
* Always add two empty lines above each headline.
* Add line breaks after 140 characters in paragraphs.
Expand Down Expand Up @@ -71,13 +71,13 @@ The short code tabs allows you to group content. Very handy for providing code s
providing configuration in different formats.

```
{{< tabs groupId="Example">}}
{{< tabs groupid="Example" style="code" >}}

{{% tab name="PHP" %}}
{{% tab title="PHP" %}}
Lorem ipsum dolor sit amet ...
{{% /tab %}}

{{% tab name="Twig" %}}
{{% tab title="Twig" %}}
Lorem ipsum dolor sit amet ...
{{% /tab %}}

Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you just want to contribute content, read the [CONTRIBUTING](CONTRIBUTING.md)

## Cloning

The project installs the Hugo Learn theme as a git submodule. Thus when cloning
The project installs the [Hugo Relearn Theme](https://mcshelby.github.io/hugo-theme-relearn/) as a git submodule. Thus when cloning
the repository, you need to use the `--recurse-submodules` parameter:

```bash
Expand All @@ -23,12 +23,19 @@ git clone --recurse-submodules https://github.com/contao/docs.git

## Updating the Theme

To update the theme after cloning, simply run the following command:
Due to the switch of the theme from Hugo Learn to Hugo Relearn, you will need to execute

```bash
git submodule foreach git pull origin master
git submodule sync
```

once, if you had already checked out the repository before the switch.

To update the theme after cloning - or after the theme switch, run the following command:

```bash
git submodule foreach git pull origin master
```

## Build

Expand Down
3 changes: 2 additions & 1 deletion docs/dev/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Contao Developer Documentation"
title: Contao Developer Documentation
type: home
---


Expand Down
26 changes: 13 additions & 13 deletions docs/dev/framework/content-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ As mentioned previously a content element is registered by registering a control
| Option | Type | Description |
| -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------|
| name | `string` | Must be `contao.content_element`. |
| type | `string` | _Optional:_ The *type* mentioned in [Type]({{< ref "#type" >}}) can be customized. |
| type | `string` | _Optional:_ The *type* mentioned in [Type]({{% ref "#type" %}}) can be customized. |
| category | `string` | Defines in which option group this content element will be placed in the content element selector. |
| template | `string` | _Optional:_ Override the generated template name. |
| renderer | `string` | _Optional:_ The renderer can be changed to `inline` or `esi`. Defaults to `forward`. See [Caching Fragments][fragments] for more details. |
Expand All @@ -137,9 +137,9 @@ As mentioned previously a content element is registered by registering a control

Applying the service tag can either be done via PHP attributes, annotations or via the YAML configuration.

{{< tabs groupId="attribute-annotation-yaml" >}}
{{< tabs groupid="attribute-annotation-yaml" style="code" >}}

{{% tab name="Attribute" %}}
{{% tab title="Attribute" %}}
{{< version-tag "4.13" >}} A content element can be registered using the `AsContentElement` PHP attribute.

```php
Expand Down Expand Up @@ -190,7 +190,7 @@ class ExampleElementController extends AbstractContentElementController
However, it is recommended to only define what you need and otherwise leave the defaults.
{{% /tab %}}

{{% tab name="Annotation" %}}
{{% tab title="Annotation" %}}
{{< version-tag "4.8" >}} A content element can be registered using the `ContentElement` annotation. The annotation can be used on the class of the content element,
if the class is invokable (has an `__invoke` method) or extends from the `AbstractContentElementController`. Otherwise the annotation can be
used on the method that will deliver the response.
Expand Down Expand Up @@ -247,7 +247,7 @@ class ExampleElementController extends AbstractContentElementController
However, it is recommended to only define what you need and otherwise leave the defaults.
{{% /tab %}}

{{% tab name="YAML" %}}
{{% tab title="YAML" %}}
{{< version-tag "4.8" >}} A content element can be registered using the `contao.content_element` service tag.

```yaml
Expand Down Expand Up @@ -415,9 +415,9 @@ article of a page.

Allowing nested fragments for your content element works via the `nestedFragments` option in the service tag:

{{< tabs groupId="attribute-annotation-yaml" >}}
{{< tabs groupid="attribute-annotation-yaml" style="code" >}}

{{% tab name="Attribute" %}}
{{% tab title="Attribute" %}}
```php
#[AsContentElement(nestedFragments: true)]
class ExampleElementController extends AbstractContentElementController
Expand All @@ -430,7 +430,7 @@ class ExampleElementController extends AbstractContentElementController
```
{{% /tab %}}

{{% tab name="Annotation" %}}
{{% tab title="Annotation" %}}
```php
/**
* @ContentElement(category="miscellaneous", nestedFragments=true)
Expand All @@ -445,7 +445,7 @@ class ExampleElementController extends AbstractContentElementController
```
{{% /tab %}}

{{% tab name="YAML" %}}
{{% tab title="YAML" %}}
```yaml
services:
App\Controller\ContentElement\ExampleElementController:
Expand All @@ -463,9 +463,9 @@ want to implement a specific slider content element which should only allow imag
instead of defining `true` for the tag's `nestedFragments` option you can instead pass an additional option called
`allowedTypes`:

{{< tabs groupId="attribute-annotation-yaml" >}}
{{< tabs groupid="attribute-annotation-yaml" style="code" >}}

{{% tab name="Attribute" %}}
{{% tab title="Attribute" %}}
```php
#[AsContentElement(nestedFragments: ['allowedTypes' => ['image', 'video']])]
class ExampleElementController extends AbstractContentElementController
Expand All @@ -478,7 +478,7 @@ class ExampleElementController extends AbstractContentElementController
```
{{% /tab %}}

{{% tab name="Annotation" %}}
{{% tab title="Annotation" %}}
```php
/**
* @ContentElement(category="miscellaneous", nestedFragments={"allowedTypes" = {"image", "video"}})
Expand All @@ -493,7 +493,7 @@ class ExampleElementController extends AbstractContentElementController
```
{{% /tab %}}

{{% tab name="YAML" %}}
{{% tab title="YAML" %}}
```yaml
services:
App\Controller\ContentElement\ExampleElementController:
Expand Down
10 changes: 5 additions & 5 deletions docs/dev/framework/cron.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ Generally cron jobs can be registered through the `contao.cronjob` service tag.
| `interval` | Can be `minutely`, `hourly`, `daily`, `weekly`, `monthly`, `yearly` or a full CRON expression, like `*/5 * * * *`. |
| `method` | Will default to `__invoke` or `onMinutely` etc. when a named interval is used. Otherwise a method name has to be defined. |

{{< tabs groupId="attribute-annotation-yaml-php" >}}
{{% tab name="Attribute" %}}
{{< tabs groupid="attribute-annotation-yaml-php" style="code" >}}
{{% tab title="Attribute" %}}
{{< version-tag "4.13" >}} Contao implements [PHP attributes](https://www.php.net/manual/en/language.attributes.overview.php) (available
since **PHP 8**) with which you can tag your service to be registered as a cron job.

Expand All @@ -159,7 +159,7 @@ In this case the cron job is executed once per hour. As mentioned before this pa
`*/5 * * * *` for "every 5 minutes".
{{% /tab %}}

{{% tab name="Annotation" %}}
{{% tab title="Annotation" %}}
{{< version-tag "4.9" >}} Contao also supports its own annotation formats via the [Service Annotation Bundle](https://github.com/terminal42/service-annotation-bundle).

```php
Expand Down Expand Up @@ -189,7 +189,7 @@ with `\`, since `*/` would close the PHP comment.
{{% /notice %}}
{{% /tab %}}

{{% tab name="YAML" %}}
{{% tab title="YAML" %}}
{{< version-tag "4.9" >}} As mentioned before you can manually add the `contao.cronjob` service tag in your service configuration.

```yaml
Expand All @@ -216,7 +216,7 @@ Only the `interval` parameter is required. In this case the cron job is executed
be a full CRON expression, e.g. `*/5 * * * *` for "every 5 minutes".
{{% /tab %}}

{{% tab name="PHP" %}}
{{% tab title="PHP" %}}

{{% notice "info" %}}
This method is deprecated since Contao **4.13** and does not work in Contao **5** anymore.
Expand Down
32 changes: 16 additions & 16 deletions docs/dev/framework/csp.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ to an external source - e.g. via an `<iframe>` or `<script src="…">` etc. - th
browser. However, your application might deliberately want to include external resources and thus it is necessary to
allow this resource specifically (or at least the domain of that resource). This can be done via the `addSource` method:

{{< tabs groupId="csp-methods" >}}
{{% tab name="PHP" %}}
{{< tabs groupid="csp-methods" style="code" >}}
{{% tab title="PHP" %}}
```php
$cspHandler->addSource('frame-src', 'https://www.youtube.com/embed/foobar123');
```
{{% /tab %}}
{{% tab name="Twig" %}}
{{% tab title="Twig" %}}
```twig
{% do csp_source('frame-src', 'https://www.youtube.com/embed/foobar123') %}
```
{{% /tab %}}
{{% tab name="PHP Template" %}}
{{% tab title="PHP Template" %}}
```php
<?php $this->addCspSource('frame-src', 'https://www.youtube.com/embed/foobar123') ?>
```
Expand All @@ -93,18 +93,18 @@ without having to resort to allowing `'unsafe-inline'` in your directives. Conta
instance still use inline JavaScript and thus will add a nonce when used. You can retrieve a nonce for `script-src` or
`style-src` like this:

{{< tabs groupId="csp-methods" >}}
{{% tab name="PHP" %}}
{{< tabs groupid="csp-methods" style="code" >}}
{{% tab title="PHP" %}}
```php
$nonce = $cspHandler->getNonce('script-src');
```
{{% /tab %}}
{{% tab name="Twig" %}}
{{% tab title="Twig" %}}
```twig
<script{{ attrs().setIfExists('nonce', csp_nonce('script-src')) }}>
```
{{% /tab %}}
{{% tab name="PHP Template" %}}
{{% tab title="PHP Template" %}}
```php
<script<?= $this->attr()->setIfExists('nonce', $this->nonce('script-src')) ?>>
```
Expand All @@ -127,19 +127,19 @@ inline scripts or inline styles. This also includes inline scripts via HTML attr
this is not possible such inline scripts can still be allowed through [hashes][CSPHash]. A hash can be generated and
added to a directive for a specific inline script or style like this:

{{< tabs groupId="csp-methods" >}}
{{% tab name="PHP" %}}
{{< tabs groupid="csp-methods" style="code" >}}
{{% tab title="PHP" %}}
```php
$cspHandler->addHash('style-src', 'display:none');
```
{{% /tab %}}
{{% tab name="Twig" %}}
{{% tab title="Twig" %}}
```twig
{% do csp_hash('display:none') %}
<div style="display:none">
```
{{% /tab %}}
{{% tab name="PHP Template" %}}
{{% tab title="PHP Template" %}}
```php
<div style="<?= $this->cspInlineStyle('display:none') ?>">
```
Expand All @@ -166,8 +166,8 @@ and then their hashes are added via the `CspHandler`. The allowed inline style p

The `'unsafe-hashes'` directive will also be added automatically by the template helpers for CSP Level 3 compliance.

{{< tabs groupId="csp-methods" >}}
{{% tab name="PHP" %}}
{{< tabs groupid="csp-methods" style="code" >}}
{{% tab title="PHP" %}}
You can use the `WysiwygStyleProcessor` directly in your services if you want to. Though typically you will likely only
need it in your templates (see other methods).

Expand Down Expand Up @@ -211,13 +211,13 @@ class ExampleService
}
```
{{% /tab %}}
{{% tab name="Twig" %}}
{{% tab title="Twig" %}}
In Twig you can use the filter `csp_inline_styles`. See the following example from Contao's `text.html.twig` template:
```twig
{{ text|csp_inline_styles|insert_tag|encode_email|raw }}
```
{{% /tab %}}
{{% tab name="PHP Template" %}}
{{% tab title="PHP Template" %}}
```php
<?= $this->cspInlineStyles($this->text) ?>
```
Expand Down
20 changes: 10 additions & 10 deletions docs/dev/framework/dca/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ way of automatically registering services under the `App\` namespace within the

For a `list.label.group` callback for example a callback might look like this:

{{< tabs groupId="attribute-annotation-yaml-php" >}}
{{% tab name="Attribute" %}}
{{< tabs groupid="attribute-annotation-yaml-php" style="code" >}}
{{% tab title="Attribute" %}}
{{< version-tag "4.13" >}} Contao implements [PHP attributes](https://www.php.net/manual/en/language.attributes.overview.php) (available
since **PHP 8**) with which you can tag your service to be registered as a callback.

Expand All @@ -95,7 +95,7 @@ class ModuleCallbackListener
```
{{% /tab %}}

{{% tab name="Annotation" %}}
{{% tab title="Annotation" %}}
{{% version-tag "4.8" %}} Contao also supports its own annotation formats via the [Service Annotation Bundle](https://github.com/terminal42/service-annotation-bundle).

```php
Expand All @@ -120,7 +120,7 @@ class ModuleCallbackListener
```
{{% /tab %}}

{{% tab name="YAML" %}}
{{% tab title="YAML" %}}
{{< version-tag "4.5" >}} Since Contao 4.5 callbacks can be registered using the `contao.callback` service tag.

```yaml
Expand All @@ -142,7 +142,7 @@ The service tag can have the following options:
| priority | `integer` | _Optional:_ priority of the callback. By default it will be executed _before_ all legacy callbacks according to the loading order of the bundles. Anything with higher than `0` will be executed before legacy callbacks. Anything with lower than `0` will be executed after legacy callbacks. In Contao **5.0** this has changed though so that these callbacks are executed _after_ all legacy callbacks according to the loading order of the bundles, when using a default priority of `0`. |
{{% /tab %}}

{{% tab name="PHP" %}}
{{% tab title="PHP" %}}
This is the old way of using DCA callbacks prior to Contao **4.7**. The table
`tl_module` and target definition `list.label.group` translates to a PHP
array configuration in the following way for example:
Expand Down Expand Up @@ -189,8 +189,8 @@ tagged with `contao.callback` and no method name is given, the `__invoke` method
be called automatically. This also means that you can define the service annotation
on the class, instead of a method:

{{< tabs groupId="attribute-annotation-yaml-php" >}}
{{% tab name="Attribute" %}}
{{< tabs groupid="attribute-annotation-yaml-php" style="code" >}}
{{% tab title="Attribute" %}}
```php
// src/EventListener/DataContainer/ModuleCallbackListener.php
namespace App\EventListener\DataContainer;
Expand All @@ -211,7 +211,7 @@ class ModuleCallbackListener
```
{{% /tab %}}

{{% tab name="Annotation" %}}
{{% tab title="Annotation" %}}
```php
// src/EventListener/DataContainer/ModuleCallbackListener.php
namespace App\EventListener\DataContainer;
Expand All @@ -234,7 +234,7 @@ class ModuleCallbackListener
```
{{% /tab %}}

{{% tab name="YAML" %}}
{{% tab title="YAML" %}}
```yaml
# config/services.yaml
services:
Expand All @@ -260,7 +260,7 @@ class ModuleCallbackListener
```
{{% /tab %}}

{{% tab name="PHP" %}}
{{% tab title="PHP" %}}
```php
// contao/dca/tl_module.php
use App\EventListener\DataContainer\ModuleCallbackListener;
Expand Down
Loading