Schrek.fr

Mon super blog :)

  1. home
  2. posts
  3. 2023
  4. 07
  5. Hugo-shortcode-pad

Shortcode Framapad

Cet article fait partie de la série: Hugo


Framapad

Un « pad » est un éditeur de texte collaboratif en ligne géré par Framasoft.

Le code original

<iframe name="embed_readwrite" src="https://hebdo.framapad.org/p/fygijewtbk-a0wa?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false" width="100%" height="600" frameborder="0"></iframe>

On peut utiliser l’import de l’iframe.

Des idées sur l’iframe en mode Hugo ici.

Sinon il y a les shortcodes.

Le Shortcode

On va créer dans le dossier des shortcodes /themes/VOTRETHEME/layouts/shortcodes un fichier pad.html

{{ $PadName := .Get "PadName" }}
{{ $showControls := .Get "showControls" | default "false" }}
{{ $showChat := .Get "showChat" | default "false" }}
{{ $showLineNumbers := .Get "showLineNumbers" | default "true" }}
{{ $width := .Get "width" | default "100%" }}
{{ $height := .Get "height" | default "600" }}
{{ $height := .Get "height" | default "600" }}
{{ $useMonospaceFont := .Get "useMonospaceFont" | default "false" }}

<iframe name="embed_readwrite" src="https://hebdo.framapad.org/p/{{- $PadName -}}?showControls={{- $showControls -}}&showChat={{- $showChat -}}&showLineNumbers={{- $showLineNumbers -}}&useMonospaceFont=false" width="{{- $width -}}" height="{{- $height -}}" frameborder="0"></iframe>

Les paramètres

Exemple

Liens

https://framapad.org/abc/fr/

comments powered by Disqus