diff --git a/ruady-og-head.php b/ruady-og-head.php
index 88259e9..f4c89b4 100644
--- a/ruady-og-head.php
+++ b/ruady-og-head.php
@@ -1,18 +1,20 @@
$target_length ) break;
+ $total_length += $lengths[$i];
+ }
+ $desc = implode(' ', array_slice($parts, 0, $i));
+ $ellipsis = substr($desc, -1, 1) == '.' ? '' : ' ...'; // full sentences with a '.' don't need ellipsis '...'
+ return $desc . $ellipsis;
+ }
+
/**
* Build the head markup for one post.
- *
- * This is the function you will customize.
*/
private static function build_markup_for_post( WP_Post $post ): string {
// Example 1: conditionally emit markup only for a specific post type.
@@ -59,7 +78,13 @@ final class Per_Post_Head_HTML {
$post_url = get_permalink( $post );
$post_title = get_the_title( $post );
- $excerpt = has_excerpt( $post ) ? get_the_excerpt( $post ) : '';
+ $excerpt = get_the_excerpt( $post );
+ $site_title = get_bloginfo( 'name' );
+ $site_url = site_url();
+ $site_url_p = parse_url($site_url);
+ $site_host = $site_url_p['host'];
+
+ $description = self::make_description(wp_strip_all_tags( $excerpt ));
// Example business logic:
// - add a meta tag for every post
@@ -68,36 +93,31 @@ final class Per_Post_Head_HTML {
ob_start();
?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-