Variable assignment gets printed in final output

Variable _assign_ment and expansion gets printed in final build instead of

##template partial has this at the top
`<% assign canonical = {{ site.url }}{{ page.url | replace:‘index.html’,’’ }} %>
{{canonical}}

`

##When you build the project, this is the output:


<% assign canonical = http://abc.biz/jekll/les1/ %>

<meta charset="UTF-8">

shouldn’t it be {% %} not <% %>

I updated to the following and now nothing prints:

{% assign canonical = {{ site.url }}{{ page.url | replace:'index.html','' }} %}
{{canonical}}

Looks like capture was the thing I was looking for:

{% capture canonical %}{{ site.url }}{{ page.url | replace:'index.html','' }}{% endcapture %}