shared-news #20

Merged
esteban merged 4 commits from shared-news into main 2026-03-08 18:35:49 +00:00
6 changed files with 31 additions and 15 deletions
Showing only changes of commit 9dc30c9299 - Show all commits

View File

@ -13,7 +13,7 @@ export default defineConfig({
vite: { vite: {
plugins: [tailwindcss()], plugins: [tailwindcss()],
}, },
site: "https://mk8nrc8p-4321.brs.devtunnels.ms",
//base: '/mockup/', //base: '/mockup/',
integrations: [markdoc(), icon(), vue()], integrations: [markdoc(), icon(), vue()],

View File

@ -2,8 +2,12 @@
import { ClientRouter } from "astro:transitions"; import { ClientRouter } from "astro:transitions";
import { GoogleAnalytics } from 'astro-google-analytics'; import { GoogleAnalytics } from 'astro-google-analytics';
const { title = "Centro del Reino de Paz y Justicia", description = "" } = const {
Astro.props; title = "Centro del Reino de Paz y Justicia",
description = "",
image = null,
url = null,
} = Astro.props;
--- ---
<head> <head>
@ -15,5 +19,7 @@ const { title = "Centro del Reino de Paz y Justicia", description = "" } =
<GoogleAnalytics id="G-26KM3HWW9J" /> <GoogleAnalytics id="G-26KM3HWW9J" />
<title>{title}</title> <title>{title}</title>
<meta name="description" content={description} /> <meta name="description" content={description} />
{url && <meta property="og:url" content={url} />}
{image && <meta property="og:image" content={image} />}
</head> </head>
<ClientRouter /> <ClientRouter />

View File

@ -106,9 +106,7 @@ const copyLink = async () => {
console.error("No se pudo copiar") console.error("No se pudo copiar")
} }
} }
const BASE_URL = typeof window !== "undefined" const BASE_URL = window.location.host
? `${window.location.protocol}//${window.location.host}`
: ""
const fullUrl = computed(() => { const fullUrl = computed(() => {
if (props.url.startsWith("http")) { if (props.url.startsWith("http")) {

View File

@ -8,7 +8,13 @@ import "@fontsource/poppins/500.css";
import "@fontsource/poppins/700.css"; import "@fontsource/poppins/700.css";
import "@fontsource-variable/kameron"; import "@fontsource-variable/kameron";
import ShareSticky from "../components/ShareSticky.vue"; import ShareSticky from "../components/ShareSticky.vue";
const { title } = Astro.props; const {
title,
description,
image,
url
} = Astro.props;
--- ---
<style is:global> <style is:global>
img { img {
@ -20,7 +26,12 @@ const { title } = Astro.props;
</style> </style>
<html lang="en" class="scroll-smooth"> <html lang="en" class="scroll-smooth">
<BaseHead title={title} /> <BaseHead
title={title}
description={description}
image={image}
url={url}
/>
<script> <script>
document.addEventListener('contextmenu', event => { document.addEventListener('contextmenu', event => {
if (event.target.tagName === 'IMG') { if (event.target.tagName === 'IMG') {
@ -30,7 +41,7 @@ const { title } = Astro.props;
</script> </script>
<body class="font-primary"> <body class="font-primary">
{Astro.url.pathname.includes('/news/') && ( {Astro.url.pathname.includes('/news/') && (
<ShareSticky client:load url={Astro.url.href} /> <ShareSticky client:only url={Astro.url.href} />
)} )}
<slot /> <slot />
<Footer /> <Footer />

View File

@ -38,7 +38,12 @@ const baseSlug = routeTranslations.news[locale] || routeTranslations.news.en;
--- ---
</style> </style>
<MainLayout> <MainLayout
title={post.data.title}
description={`${post.data.title} - ${post.data.city ?? ""} ${post.data.country ?? ""}`}
image={post.data.gallery && post.data.gallery.length > 0 ? new URL(post.data.gallery[0].image.src, Astro.site) : null}
url={new URL(`/${locale}/${baseSlug}/${post.id}`, Astro.site)}
>
<div class="container mx-auto md:py-16 py-8"> <div class="container mx-auto md:py-16 py-8">
<Header /> <Header />
</div> </div>

View File

@ -19,15 +19,11 @@ export async function getStaticPaths() {
const { post } = Astro.props; const { post } = Astro.props;
const { Content } = await render(post); const { Content } = await render(post);
console.log("astro site", Astro.site);
const baseUrl = Astro.site ?? "https://mk8nrc8p-4321.brs.devtunnels.ms"; const baseUrl = Astro.site ?? "https://mk8nrc8p-4321.brs.devtunnels.ms";
const pageUrl = new URL(`/es/news/${post.id}`, baseUrl).toString(); const pageUrl = new URL(`/es/news/${post.id}`, baseUrl).toString();
const imageUrl = post.data.thumbnail
? new URL(post.data.thumbnail.src, baseUrl).toString()
: null;
const description = `${post.data.title} - ${post.data.city ?? ""} ${post.data.country ?? ""}`;
--- ---