skip to Main Content

Hi i was using bolt and twig and i got this error

A template that extends another one cannot start with a byte order mark (BOM); it must be removed in “index.twig” at line 1.

but I cant seem to find out what the problem here is. searched arround on the internet found some answers here on stack like this one. but this didnt seem to help for me.

my _master.twig file looks like this.

<!DOCTYPE html>
<html lang="en">
<head>
   {% block SEO %}
   {% endblock %}
   {% include "partials/_head.twig" %}
</head>
<body>
   {% include "partials/_header.twig" %}
   {% block content %}
   {% enblock %}
   {% include "partials/_footer.twig" %}
   {% include "partials/_scripts.twig" %}
</body>
</html>

And my index.twig like this

{% extends "partials/_master.twig" %}

{% block SEO %}
  <title>Home</title>
  <meta name="description" content="Beschrijving"/>
  <meta name="keywords" content="woordjes, enzo"/>
{% endblock %}

{% block content %}
  <div class="page"...>
{% endblock %}

ive had some other bolt/twig projects but this is how i did it everytime now suddenly it gives me back this error. i hope someone can help me solve this error.

2

Answers


  1. Chosen as BEST ANSWER

    So this happened to me again. For people reading this post in the future,

    If you open files that are a bit old or outdated then PHP storm may change the encoding type for some reason.

    So if you open older files. keep in mind that PHP storm may change the encoding.

    Hope this helps, happy coding!


  2. It’s an encoding problem.

    According to this, you must encode your document with UTF-8 without BOM.

    Best regards,

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search