Skip to content

Conversation

@ldez
Copy link
Contributor

@ldez ldez commented Sep 2, 2025

I forgot the with and to fill the TODO.

@netlify
Copy link

netlify bot commented Sep 2, 2025

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit acd18d0
🔍 Latest deploy log https://app.netlify.com/projects/hugo-hextra/deploys/68b80ff9e86efd000829b08e
😎 Deploy Preview https://deploy-preview-817--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@ldez ldez changed the title fix: Matomo analytics fix(analytics): Matomo analytics Sep 2, 2025
https://developer.matomo.org/guides/tracking-javascript-guide
*/ -}}

{{- with .Site.Params.analytics.matomo -}}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also checked at

{{- if .Site.Params.analytics.matomo -}}

I guess we don't need both?

Copy link
Contributor Author

@ldez ldez Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 2 different things:

  • The if is purely conditional and doesn't change the scope of .
  • The with is conditional, but it also changes the scope of .

IMHO, it's better to have a larger scope at the global partial level (because it's easier to override), and inside the partial have a restricted scope for readability and maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 If someone wants to override (to a specific analytics), he can either override layouts/_partials/components/analytics/analytics.html or add an element inside layouts/_partials/custom/head-end.html.

So I think I will use with.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 2 different things:

  • The if is purely conditional and doesn't change the scope of .
  • The with is conditional, but it also changes the scope of .

IMHO, it's better to have a larger scope at the global partial level (because it's easier to override), and inside the partial have a restricted scope for readability and maintenance.

I see, that makes more sense, I think I’d actually prefer giving the partial a broader scope now 🤔

@imfing imfing merged commit 184ee25 into imfing:main Sep 3, 2025
4 checks passed
@ldez ldez deleted the fix/matomo branch September 3, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants