diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 2fe172b..90f73e4 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -1,23 +1,32 @@ % my $categories = stash 'categories'; % my $current_category_slug = stash 'current_category_slug'; +% my $description_og = stash 'description_og'; +% $description_og = substr $description_og, 0, 300; +% $description_og =~ s/\s\S+$//; +% $description_og.='...'; +% my $base_url = config 'base_url'; % my $css_version = config 'css_version'; <%= title %> - + - + % my $ogimage = stash 'ogimage'; % my $user_agent = stash 'useragent'; -% if (defined $ogimage && $user_agent !~ /TelegramBot/) { - + +% if (defined $ogimage) { + + % } else { - + + % } - + +
diff --git a/templates/page/attribute.html.ep b/templates/page/attribute.html.ep index 500c15a..aea06c7 100644 --- a/templates/page/attribute.html.ep +++ b/templates/page/attribute.html.ep @@ -8,8 +8,10 @@ % % my $category = stash 'category'; % my $attribute = stash 'attribute'; +% my $description_og = '
'.$attribute->{description}.'
'; +% $description_og = Mojo::DOM->new($description_og)->all_text; % my $posts = stash 'posts'; -% layout 'default', current_category_slug => $category->{slug}; +% layout 'default', current_category_slug => $category->{slug}, description_og => $description_og; % title $attribute->{title};

<%= $attribute->{title} %>

diff --git a/templates/page/index.html.ep b/templates/page/index.html.ep index a947816..d1be0bc 100644 --- a/templates/page/index.html.ep +++ b/templates/page/index.html.ep @@ -1,12 +1,15 @@ % use Data::Dumper; % use DateTime::Format::ISO8601; +% use Mojo::DOM; % % use Mojo::DOM; % use Mojo::Util; % % use BurguillosInfo::Posts; % -% layout 'default', current_category_slug => $current_category->{slug}; +% my $description_og = '
'.$current_category->{description}.'
'; +% $description_og = Mojo::DOM->new($description_og)->all_text; +% layout 'default', current_category_slug => $current_category->{slug}, description_og => $description_og; % title $current_category->{title};

<%= $current_category->{title} %>

diff --git a/templates/page/post.html.ep b/templates/page/post.html.ep index a3797c8..2617f11 100644 --- a/templates/page/post.html.ep +++ b/templates/page/post.html.ep @@ -6,7 +6,9 @@ % use BurguillosInfo::Posts; % use BurguillosInfo::Categories; % my $categories = BurguillosInfo::Categories->new->Retrieve; -% layout 'default', current_category_slug => $current_category->{slug}, categories => $categories; +% my $description_og = '
'.$post->{content}.'
'; +% $description_og = Mojo::DOM->new($description_og)->all_text; +% layout 'default', current_category_slug => $current_category->{slug}, categories => $categories, description_og => $description_og; % title $post->{title};

<%= $post->{title} %>