| @@ -1799,12 +1799,16 @@ | ||
| 1799 | 1799 | // Get image dimensions and alt text |
| 1800 | 1800 | $image_id = get_post_thumbnail_id($this->current_post_id); |
| 1801 | 1801 | $image_meta = wp_get_attachment_metadata($image_id); |
| 1802 | 1802 | if ($image_meta) { |
| 1803 | + // The `large` file being published, not the original it | |
| 1804 | + // was generated from: the metadata's own width and height | |
| 1805 | + // describe an image this tag does not point at (#847). | |
| 1806 | + $image_file = \ThinkRank\SEO\Attachment_Lookup::describe((int) $image_id, (string) $image_url); | |
| 1803 | 1807 | // SVGs (and other vector uploads) report 0x0 — emitting |
| 1804 | 1808 | // those as og:image dimensions is invalid, so skip them. |
| 1805 | - $og_width = isset($image_meta['width']) ? (int) $image_meta['width'] : 0; | |
| 1806 | - $og_height = isset($image_meta['height']) ? (int) $image_meta['height'] : 0; | |
| 1809 | + $og_width = $image_file['width']; | |
| 1810 | + $og_height = $image_file['height']; | |
| 1807 | 1811 | if ($og_width > 0 && $og_height > 0) { |
| 1808 | 1812 | echo "<meta property=\"og:image:width\" content=\"" . esc_attr($og_width) . "\" />\n"; |
| 1809 | 1813 | echo "<meta property=\"og:image:height\" content=\"" . esc_attr($og_height) . "\" />\n"; |
| 1810 | 1814 | } |
| @@ -1809,9 +1813,9 @@ | ||
| 1809 | 1813 | echo "<meta property=\"og:image:height\" content=\"" . esc_attr($og_height) . "\" />\n"; |
| 1810 | 1814 | } |
| 1811 | 1815 | // Derive the real mime type instead of hardcoding image/jpeg, |
| 1812 | 1816 | // which mislabels PNG/WebP featured images. |
| 1813 | - $image_mime = get_post_mime_type($image_id); | |
| 1817 | + $image_mime = $image_file['type']; | |
| 1814 | 1818 | if ($image_mime) { |
| 1815 | 1819 | echo "<meta property=\"og:image:type\" content=\"" . esc_attr($image_mime) . "\" />\n"; |
| 1816 | 1820 | } |
| 1817 | 1821 | } |
| @@ -2746,8 +2750,22 @@ | ||
| 2746 | 2750 | // (term description, post type description, author bio) |
| 2747 | 2751 | $archive_description = $this->get_archive_meta_description(); |
| 2748 | 2752 | if ($archive_description) { |
| 2749 | 2753 | return $archive_description; |
| 2754 | + } | |
| 2755 | + | |
| 2756 | + // The blog-index homepage's own description (Site Identity | |
| 2757 | + // homepage_description, #897), in the same vocabulary as its title. A | |
| 2758 | + // static front page is a page, and its description is set on it. | |
| 2759 | + if (is_front_page() && is_home() && $this->site_identity_data && $this->site_identity_data['enabled']) { | |
| 2760 | + $identity = $this->site_identity_manager->get_settings('site'); | |
| 2761 | + $template = trim((string) ($identity['homepage_description'] ?? '')); | |
| 2762 | + if ($template !== '') { | |
| 2763 | + $homepage_description = trim($this->process_title_template($template, $this->get_title_placeholders())); | |
| 2764 | + if ($homepage_description !== '') { | |
| 2765 | + return $homepage_description; | |
| 2766 | + } | |
| 2767 | + } | |
| 2750 | 2768 | } |
| 2751 | 2769 | |
| 2752 | 2770 | // Third priority: Site Identity default meta description |
| 2753 | 2771 | if ($this->site_identity_data && $this->site_identity_data['enabled']) { |