Set fallback URL

Motivation

To provide Staticman support for the theme Huginn. You may refer to my recent blog post Huginn theme with Staticman for details.

Demo Frama Pages: https://staticman-gitlab-pages.frama.io/huginn (Source)

Problem

I would like to have a fallback URL (for Staticman API endpoint).

In the Jekyll theme Beautiful Jekyll, it’s done like

<form ...
  action="{{ site.staticman.endpoint | default: 'https://staticman-frama.herokuapp.com/v3/entry/github/' }}{{ site.staticman.repository }}/{{ site.staticman.branch }}/comments">

I tried translating this to Hugo, and wrote

<form ...
  action="{{ .Site.Params.staticman.endpoint | default 'https://staticman-frama.herokuapp.com/v3/entry/github/' }}...">

and I got

Error: "/home/vin100/huginn/layouts/partials/staticman-comments.html:59:1": parse failed: template: partials/staticman-comments.html:59: malformed character constant: 'https://staticman-frama.herokuapp.com'

How can a URL be supplied as the default value?

Try using double quotes instead of single quotes

1 Like

Thanks for quick answer ! This saves the day.

P.S. The code in the question body is not yet available in the linked Framagit repo by the time I write this question, but I’ll publish my work very soon.