Skip to content

Commit

Permalink
Update Hugo Blox
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoalcarazdelaosa committed Aug 17, 2024
1 parent 8de7663 commit 92769f5
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 17 deletions.
2 changes: 1 addition & 1 deletion assets/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"baseUrl": ".",
"paths": {
"*": [
"../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!hugo!blox/hugo-blox-builder/modules/blox-bootstrap/[email protected].20240713204532-5660081624a8/assets/*"
"../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!hugo!blox/hugo-blox-builder/modules/blox-bootstrap/[email protected].20240813182432-8778c4b5ed89/assets/*"
]
}
}
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module github.com/rodrigoalcarazdelaosa/fisiquimicamente

go 1.22
go 1.23

require (
github.com/HugoBlox/hugo-blox-builder/modules/blox-bootstrap/v5 v5.9.8-0.20240713204532-5660081624a8
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.2-0.20240713204532-5660081624a8
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2-0.20240713204532-5660081624a8
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-reveal v1.1.3-0.20240713204532-5660081624a8
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.2.3-0.20240713204532-5660081624a8
github.com/HugoBlox/hugo-blox-builder/modules/blox-bootstrap/v5 v5.9.8-0.20240813182432-8778c4b5ed89
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.2-0.20240813182432-8778c4b5ed89
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2-0.20240813182432-8778c4b5ed89
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-reveal v1.1.3-0.20240813182432-8778c4b5ed89
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.2.3-0.20240813182432-8778c4b5ed89
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
github.com/HugoBlox/hugo-blox-builder/modules/blox-bootstrap/v5 v5.9.8-0.20240713204532-5660081624a8 h1:NJoDnLFIXRwLk8+PMDLKR6/sFU/1cWvdTe1JeVox1u8=
github.com/HugoBlox/hugo-blox-builder/modules/blox-bootstrap/v5 v5.9.8-0.20240713204532-5660081624a8/go.mod h1:xZiTEEurbEwj/NhZohozvlyLCGVCT2wARHDAJeqKG/c=
github.com/HugoBlox/hugo-blox-builder/modules/blox-bootstrap/v5 v5.9.8-0.20240813182432-8778c4b5ed89 h1:UYnbXqb2exVZk7M3eHmQQYZ6M2mVq3jYIKp7y+lNg+Y=
github.com/HugoBlox/hugo-blox-builder/modules/blox-bootstrap/v5 v5.9.8-0.20240813182432-8778c4b5ed89/go.mod h1:xZiTEEurbEwj/NhZohozvlyLCGVCT2wARHDAJeqKG/c=
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.1/go.mod h1:So8+V2U+TNxlXmcpZfdDX0muLh3PdJ7z92h30sv3bZg=
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.2-0.20240713204532-5660081624a8 h1:GH5aAx1ln9kfYny6znjfIjkdrMjEdRdomaZe+jajn1M=
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.2-0.20240713204532-5660081624a8/go.mod h1:So8+V2U+TNxlXmcpZfdDX0muLh3PdJ7z92h30sv3bZg=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2-0.20240713204532-5660081624a8 h1:HfLPL2+hU6ADD8Wfm2YWL6AREGXy42Kim4OtaQ2ksbw=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2-0.20240713204532-5660081624a8/go.mod h1:C7jfxMLv1bEUqbM9XDSmEpfOpS8w06OgqNDEcbuRgL4=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-reveal v1.1.3-0.20240713204532-5660081624a8 h1:8t5ZCF6rDy7K6h2bu8GJPXLlC/X0aJ31Pc+3dsajFmg=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-reveal v1.1.3-0.20240713204532-5660081624a8/go.mod h1:F7quX1aEkV2pToTpmDBXOSTkytAnCKkqv/JFLclqa2g=
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.2-0.20240813182432-8778c4b5ed89 h1:bKZk0GrU5SYCD6JpgP3vusHD2nXc0Cfa+G47OnyyNMo=
github.com/HugoBlox/hugo-blox-builder/modules/blox-core v0.3.2-0.20240813182432-8778c4b5ed89/go.mod h1:So8+V2U+TNxlXmcpZfdDX0muLh3PdJ7z92h30sv3bZg=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2-0.20240813182432-8778c4b5ed89 h1:NBcqvNItQf3fOQZO2i5uWDe7k9+rX1n8dcYwQCJ31Ok=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.2-0.20240813182432-8778c4b5ed89/go.mod h1:C7jfxMLv1bEUqbM9XDSmEpfOpS8w06OgqNDEcbuRgL4=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-reveal v1.1.3-0.20240813182432-8778c4b5ed89 h1:AeHuVDz7t6RLBmxNyxW+gF87Rz1B4S4Hp3+Eo4IrDf4=
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-reveal v1.1.3-0.20240813182432-8778c4b5ed89/go.mod h1:F7quX1aEkV2pToTpmDBXOSTkytAnCKkqv/JFLclqa2g=
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.2.2/go.mod h1:NsESu6cEms1DgH84icCyylElg2Zu8A0f7Fma5JR0LZE=
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.2.3-0.20240713204532-5660081624a8 h1:LZzKKxmyIGSNkzmOdE1MvtPCJGPYhjYX4maXRAuDRug=
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.2.3-0.20240713204532-5660081624a8/go.mod h1:NsESu6cEms1DgH84icCyylElg2Zu8A0f7Fma5JR0LZE=
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.2.3-0.20240813182432-8778c4b5ed89 h1:p/Ddm97+1d+RV+qveHe0QUITNyf9oWe8VAIVOeXRFpU=
github.com/HugoBlox/hugo-blox-builder/modules/blox-seo v0.2.3-0.20240813182432-8778c4b5ed89/go.mod h1:NsESu6cEms1DgH84icCyylElg2Zu8A0f7Fma5JR0LZE=
42 changes: 42 additions & 0 deletions layouts/partials/analytics/google_analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{ $ga := site.Params.marketing.analytics.google_analytics | default .Site.Config.Services.GoogleAnalytics.ID | default "" }}

{{ if hugo.IsProduction | and $ga }}

{{ $gtag_config := cond site.Params.features.privacy_pack.enable "{ 'anonymize_ip': true }" "{}" }}
<script async src="https://www.googletagmanager.com/gtag/js?id={{$ga}}"></script>
<script>
window.dataLayer = window.dataLayer || [];

function gtag() {
dataLayer.push(arguments);
}

function trackOutboundLink(url, target) {
gtag('event', 'click', {
'event_category': 'outbound',
'event_label': url,
'transport_type': 'beacon',
'event_callback': function () {
if (target !== '_blank') {
document.location = url;
}
}
});
console.debug("Outbound link clicked: " + url);
}

function onClickCallback(event) {
if ((event.target.tagName !== 'A') || (event.target.host === window.location.host)) {
return;
}
trackOutboundLink(event.target, event.target.getAttribute('target')); // Send GA event.
}

gtag('js', new Date());
gtag('config', '{{$ga}}', {{$gtag_config|safeJS}});
gtag('set', {'cookie_flags': 'SameSite=None;Secure'});

// Outbound link tracking.
document.addEventListener('click', onClickCallback, false);
</script>
{{ end }}
70 changes: 70 additions & 0 deletions layouts/partials/components/feedback.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{ $ga := site.Params.marketing.analytics.google_analytics | default .Site.Config.Services.GoogleAnalytics.ID | default "" }}
{{ $show_feedback := .Params.feedback | default true }}

{{ if hugo.IsProduction | and $ga | and $show_feedback }}
<style>
.btn-feedback {
display: inline-block;
}
.btn-feedback-negative {
margin-left: 1em;
}
.feedback--response {
display: none;
margin-top: 1em;
}
.feedback--response__visible {
display: block;
}
</style>
<div class="d-print-none widget--feedback">
<h2 class="feedback--title">{{ i18n "feedback_widget_title" | default "Feedback" }}</h2>
<p class="feedback--question">{{ i18n "feedback_widget_question" | default "Was this page helpful?" }}</p>
<p class="feedback--response feedback--response-positive">
{{ (site.Params.features.feedback.responses.positive | default "🙏") | markdownify | safeHTML }}
</p>
<p class="feedback--response feedback--response-negative">
{{ (site.Params.features.feedback.responses.negative | default "🙏") | markdownify | safeHTML }}
</p>
<button class="btn btn-primary mb-4 btn-feedback btn-feedback-positive">
{{ i18n "feedback_widget_answer_positive" | default "😍 Yes" }}
</button>
<button class="btn btn-primary mb-4 btn-feedback btn-feedback-negative">
{{ i18n "feedback_widget_answer_negative" | default "😡 No" }}
</button>
</div>
<script>
const btnYes = document.querySelector('.btn-feedback-positive');
const btnNo = document.querySelector('.btn-feedback-negative');
const responseYes = document.querySelector('.feedback--response-positive');
const responseNo = document.querySelector('.feedback--response-negative');
const disableButtons = () => {
btnYes.disabled = true;
btnNo.disabled = true;
};
const sendFeedback = (value) => {
if (typeof gtag !== 'function') return;
gtag('event', 'click', {
'event_category': 'page_rating',
'event_label': window.location.pathname,
'value': value,
'transport_type': 'beacon',
'event_callback': function () {
console.debug(`✅ Feedback sent ${value}`);
}
});
};
btnYes.addEventListener('click', () => {
console.debug('Feedback response: 😍');
responseYes.classList.add('feedback--response__visible');
disableButtons();
sendFeedback(1);
});
btnNo.addEventListener('click', () => {
console.debug('Feedback response: 😡');
responseNo.classList.add('feedback--response__visible');
disableButtons();
sendFeedback(0);
});
</script>
{{ end }}

0 comments on commit 92769f5

Please sign in to comment.