Variable assignment gets printed in final output


#1

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">

#2

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


#3

I updated to the following and now nothing prints:

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

#4

Looks like capture was the thing I was looking for:

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