re-laayout and show site headline in social media share text

This commit is contained in:
2026-03-01 21:48:15 +01:00
parent a308ea5609
commit 3ed6c8bdbe

View File

@@ -105,6 +105,7 @@ final class Ruady_OG_Head {
$og_image_url = user_trailingslashit( trailingslashit( $post_url ) . 'og-image' ); $og_image_url = user_trailingslashit( trailingslashit( $post_url ) . 'og-image' );
$description = self::make_description(wp_strip_all_tags( $excerpt )); $description = self::make_description(wp_strip_all_tags( $excerpt ));
$og_description = "Da Ruady. Hansdampf in allen Gassen.";
// Example business logic: // Example business logic:
// - add a meta tag for every post // - add a meta tag for every post
@@ -119,7 +120,7 @@ final class Ruady_OG_Head {
<meta property="og:url" content="<?php echo esc_url( $site_url ); ?>"> <meta property="og:url" content="<?php echo esc_url( $site_url ); ?>">
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<meta property="og:title" content="<?php echo esc_attr( $post_title ); ?> &#8211; <?php echo esc_attr( $site_title ); ?>"> <meta property="og:title" content="<?php echo esc_attr( $post_title ); ?> &#8211; <?php echo esc_attr( $site_title ); ?>">
<meta property="og:description" content="<?php echo esc_attr( $description ); ?>"> <meta property="og:description" content="<?php echo esc_attr( $og_description ); ?>">
<meta property="og:image" content="<?php echo esc_url( $og_image_url ) ?>"> <meta property="og:image" content="<?php echo esc_url( $og_image_url ) ?>">
<!-- Twitter Meta Tags --> <!-- Twitter Meta Tags -->
@@ -127,7 +128,7 @@ final class Ruady_OG_Head {
<meta property="twitter:domain" content="<?php echo esc_attr( $site_host ); ?>"> <meta property="twitter:domain" content="<?php echo esc_attr( $site_host ); ?>">
<meta property="twitter:url" content="<?php echo esc_url( $site_url ); ?>"> <meta property="twitter:url" content="<?php echo esc_url( $site_url ); ?>">
<meta name="twitter:title" content="<?php echo esc_attr( $post_title ); ?> &#8211; <?php echo esc_attr( $site_title ); ?>"> <meta name="twitter:title" content="<?php echo esc_attr( $post_title ); ?> &#8211; <?php echo esc_attr( $site_title ); ?>">
<meta name="twitter:description" content="<?php echo esc_attr( $description ); ?>"> <meta name="twitter:description" content="<?php echo esc_attr( $og_description ); ?>">
<meta property="twitter:image" content="<?php echo esc_url( $og_image_url ) ?>"> <meta property="twitter:image" content="<?php echo esc_url( $og_image_url ) ?>">
<link rel="canonical" href="<?php echo esc_url( $post_url ); ?>"> <link rel="canonical" href="<?php echo esc_url( $post_url ); ?>">
@@ -198,10 +199,10 @@ final class Ruady_OG_Head {
$bg = imagecolorallocate( $image, 224, 241, 212 ); // theme background (light green) $bg = imagecolorallocate( $image, 224, 241, 212 ); // theme background (light green)
$fg = imagecolorallocate( $image, 0, 0, 0 ); // theme foreground (black) $fg = imagecolorallocate( $image, 0, 0, 0 ); // theme foreground (black)
$tt = imagecolorallocate( $image, 72, 119, 40 ); // theme primary (dark green) $tt = imagecolorallocate( $image, 72, 119, 40 ); // theme primary (dark green)
//$accent = imagecolorallocate( $image, 204, 235, 235 ); // theme tertiary (light blue) $accent = imagecolorallocate( $image, 204, 235, 235 ); // theme tertiary (light blue)
imagefilledrectangle( $image, 0, 0, $width, $height, $bg ); imagefilledrectangle( $image, 0, 0, $width, $height, $bg );
//imagefilledrectangle( $image, 0, 0, $width, 12, $accent ); imagefilledrectangle( $image, 0, $height-30, $width, $height, $accent );
$title = wp_strip_all_tags( get_the_title( $post ) ); $title = wp_strip_all_tags( get_the_title( $post ) );
$site = wp_strip_all_tags( get_bloginfo( 'name' ) ); $site = wp_strip_all_tags( get_bloginfo( 'name' ) );
@@ -225,12 +226,10 @@ final class Ruady_OG_Head {
$fontFile = __DIR__ . '/fonts/EBGaramond-VariableFont_wght.ttf'; $fontFile = __DIR__ . '/fonts/EBGaramond-VariableFont_wght.ttf';
//$size = 28; //$size = 28;
$size = 36; $size = 36;
//$x = 60; $x = 60;
$x = (int) (($width - $height) / 2 + 30);
$y = 120; $y = 120;
$lineHeight = (int) ($size * 1.9); $lineHeight = (int) ($size * 1.9);
//$maxWidth = 1080; $maxWidth = 1080;
$maxWidth = $height - 2*60; // prepare text for 1:1 ratio cropping
$maxHeight = $height - 60; $maxHeight = $height - 60;
// wrap_text_ttf(string $text, int $maxWidth, string $fontFile, float $size) // wrap_text_ttf(string $text, int $maxWidth, string $fontFile, float $size)