I generally give Twig files a "twig" extension. As I understand it these Twig files are usually recognised as HTML like files by Linux using some sort of scan algorithm. So Nemo for example represents these files with a web icon and clicking on properties shows the file type as "Text (text/html)". However sometimes when there is no actual HTML near the top of the file Linux recognises the file as plain text instead. On such files I tried adding a HTML comment as the first line:
<!-- Twig file -->
Which works OK for Twig macro files, but not for regular templates as it causes an error:
Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'A template that extends another one cannot have a body in "std.twig" at line 1.' in /var/www/html/vendor/twig/twig/lib/Twig/Parser.php:379 Stack trace: ...
I know that it is possible to put a "html" extension after the "twig" extension, so the full file name is for example:
But that is cumbersome.
So I was wondering if instead it is possible to give Linux (Mint in my case) a new file type, and perhaps have a different icon in Nemo from either the text or HTML icons?