Grob
1
Hi all!
I am trying to use PHP with Hugo—and read quite a lot here.
The ‘complicated’ stuff is working:
mediaTypes:
application/x-php:
suffixes:
- php
outputFormats:
PHP:
mediaType: application/x-php
isHTML: true
baseName: index
outputs:
home:
- PHP
But I cannot prevent Hugo from modifying the PHP code:
I tried
{{ readFile "file.php" | safeHTML }}
and various combinations of safeHTML
, .RawContent
, plainify
, htmlUnescape
…
Any other idea?
Thanks in advance!
ju52
2
Put the php files under static/php. Hugo will copy it to /php.
To use it, create links to it. Don’t forget to config your web server to process php.
1 Like
zwbetz
3
Try adding to your PHP output format:
isPlainText: true
You sacrifice html template security, but as long as you trust your code, it may fix your issue.
1 Like
Grob
4
Thank you very, very much, guys!
Ok, now I get what the isPlainText setting is good for