Agregar Tracking
This commit is contained in:
parent
3ae1904dd4
commit
c3275dde48
1 changed files with 157 additions and 113 deletions
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
import '@/styles/global.css';
|
||||
import siteConfig from '@/config/site.config';
|
||||
import Header from '@/components/layout/Header.astro';
|
||||
import Footer from '@/components/layout/Footer.astro';
|
||||
import CursorTrail from '@/components/effects/CursorTrail.astro';
|
||||
import "@/styles/global.css";
|
||||
import siteConfig from "@/config/site.config";
|
||||
import Header from "@/components/layout/Header.astro";
|
||||
import Footer from "@/components/layout/Footer.astro";
|
||||
import CursorTrail from "@/components/effects/CursorTrail.astro";
|
||||
|
||||
interface Props {
|
||||
title?: string;
|
||||
|
|
@ -24,7 +24,12 @@ const canonicalURL = new URL(Astro.url.pathname, siteConfig.url);
|
|||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="es" class="scroll-smooth dark" data-theme="default" data-theme-mode="system">
|
||||
<html
|
||||
lang="es"
|
||||
class="scroll-smooth dark"
|
||||
data-theme="default"
|
||||
data-theme-mode="system"
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
|
@ -42,39 +47,67 @@ const canonicalURL = new URL(Astro.url.pathname, siteConfig.url);
|
|||
<meta property="og:url" content={canonicalURL} />
|
||||
<meta property="og:title" content={pageTitle} />
|
||||
<meta property="og:description" content={description} />
|
||||
{image && <meta property="og:image" content={new URL(image, siteConfig.url)} />}
|
||||
{
|
||||
image && (
|
||||
<meta
|
||||
property="og:image"
|
||||
content={new URL(image, siteConfig.url)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content={pageTitle} />
|
||||
<meta name="twitter:description" content={description} />
|
||||
{image && <meta name="twitter:image" content={new URL(image, siteConfig.url)} />}
|
||||
{
|
||||
image && (
|
||||
<meta
|
||||
name="twitter:image"
|
||||
content={new URL(image, siteConfig.url)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
<script is:inline>
|
||||
(function () {
|
||||
const VALID_MODES = ['system', 'light', 'dark'];
|
||||
const VALID_MODES = ["system", "light", "dark"];
|
||||
function getMode() {
|
||||
try {
|
||||
const stored = localStorage.getItem('theme');
|
||||
const stored = localStorage.getItem("theme");
|
||||
if (VALID_MODES.indexOf(stored) !== -1) return stored;
|
||||
} catch {}
|
||||
return 'system';
|
||||
return "system";
|
||||
}
|
||||
function applyMode(el) {
|
||||
const mode = getMode();
|
||||
el.setAttribute('data-theme-mode', mode);
|
||||
const isDark = mode === 'dark' || (mode === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
if (isDark) el.classList.add('dark');
|
||||
else el.classList.remove('dark');
|
||||
el.setAttribute("data-theme-mode", mode);
|
||||
const isDark =
|
||||
mode === "dark" ||
|
||||
(mode === "system" &&
|
||||
window.matchMedia("(prefers-color-scheme: dark)")
|
||||
.matches);
|
||||
if (isDark) el.classList.add("dark");
|
||||
else el.classList.remove("dark");
|
||||
}
|
||||
applyMode(document.documentElement);
|
||||
if (!window.__themeListenersInit) {
|
||||
window.__themeListenersInit = true;
|
||||
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
const onSchemeChange = function () { if (getMode() === 'system') applyMode(document.documentElement); };
|
||||
if (mql.addEventListener) mql.addEventListener('change', onSchemeChange);
|
||||
const mql = window.matchMedia(
|
||||
"(prefers-color-scheme: dark)",
|
||||
);
|
||||
const onSchemeChange = function () {
|
||||
if (getMode() === "system")
|
||||
applyMode(document.documentElement);
|
||||
};
|
||||
if (mql.addEventListener)
|
||||
mql.addEventListener("change", onSchemeChange);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script
|
||||
defer
|
||||
src="https://umami.aoncoz.cc/script.js"
|
||||
data-website-id="58738a7d-4beb-46c1-906b-75ec06340f25"></script>
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen bg-background text-foreground antialiased">
|
||||
|
|
@ -100,30 +133,41 @@ const canonicalURL = new URL(Astro.url.pathname, siteConfig.url);
|
|||
aria-label="Volver arriba"
|
||||
class="fixed bottom-6 right-6 z-50 h-12 w-12 rounded-full bg-background border border-border-strong text-foreground-muted shadow-md hover:bg-secondary transition-all duration-200 opacity-0 translate-y-4 pointer-events-none"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="mx-auto"><path d="m18 15-6-6-6 6"/></svg>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="mx-auto"><path d="m18 15-6-6-6 6"></path></svg
|
||||
>
|
||||
</button>
|
||||
|
||||
<script is:inline>
|
||||
(function () {
|
||||
const THRESHOLD = 400;
|
||||
const btn = document.getElementById('back-to-top');
|
||||
const btn = document.getElementById("back-to-top");
|
||||
if (!btn) return;
|
||||
|
||||
function update() {
|
||||
if (window.scrollY > THRESHOLD) {
|
||||
btn.style.opacity = '1';
|
||||
btn.style.translate = '0 0';
|
||||
btn.style.pointerEvents = 'auto';
|
||||
btn.style.opacity = "1";
|
||||
btn.style.translate = "0 0";
|
||||
btn.style.pointerEvents = "auto";
|
||||
} else {
|
||||
btn.style.opacity = '0';
|
||||
btn.style.translate = '0 1rem';
|
||||
btn.style.pointerEvents = 'none';
|
||||
btn.style.opacity = "0";
|
||||
btn.style.translate = "0 1rem";
|
||||
btn.style.pointerEvents = "none";
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('scroll', update, { passive: true });
|
||||
btn.addEventListener('click', function () {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
window.addEventListener("scroll", update, { passive: true });
|
||||
btn.addEventListener("click", function () {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
});
|
||||
update();
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue