gethugothemes / liva-hugo

Liva is a personal blog template powered by Hugo.
https://gethugothemes.com/products/liva/?utm_source=liva_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
275 stars 237 forks source link

Refactor scripts in footer.html partial #55

Open iwtga opened 1 year ago

iwtga commented 1 year ago

The current cookie banner code has some issues such that the code formatters flag it as incorrect code. It is because it doesn't follow the correct coding guidelines.

The cookie banner script lies in layouts/partials/footer.html

The line which assigns the cookie expiry date is as:

 expires: {{ site.Params.cookies.expire_days }}

This assignment causes the code formatters to go berserk.

The correct assignment would be:

expires: Number('{{ .Site.Params.cookies.expire_days }}')

Same goes for the script in the same file where the index URL is assigned as:

var indexURL = {{ "index.json" | absURL }}

The correct way would be:

var indexURL = '{{ "index.json" | absURL }}'