Merge pull request #15 from stevedylandev/fix/posts-fixed-default-og
ac26deab
fix/posts fixed default og
7 file(s) · +22 −2
fix/posts fixed default og
| 2973 | 2973 | ||
| 2974 | 2974 | [[package]] |
|
| 2975 | 2975 | name = "posts" |
|
| 2976 | - | version = "0.1.1" |
|
| 2976 | + | version = "0.1.2" |
|
| 2977 | 2977 | dependencies = [ |
|
| 2978 | 2978 | "andromeda-auth", |
|
| 2979 | 2979 | "askama 0.15.6", |
| 1 | 1 | [package] |
|
| 2 | 2 | name = "posts" |
|
| 3 | - | version = "0.1.1" |
|
| 3 | + | version = "0.1.2" |
|
| 4 | 4 | edition = "2024" |
|
| 5 | 5 | description = "CMS blog with admin interface" |
|
| 6 | 6 | license = "MIT" |
| 64 | 64 | nav_links: Vec<NavLink>, |
|
| 65 | 65 | favicon_url: String, |
|
| 66 | 66 | og_image_url: String, |
|
| 67 | + | site_url: String, |
|
| 67 | 68 | } |
|
| 68 | 69 | ||
| 69 | 70 | #[derive(Template)] |
|
| 75 | 76 | rendered_content: String, |
|
| 76 | 77 | favicon_url: String, |
|
| 77 | 78 | og_image_url: String, |
|
| 79 | + | site_url: String, |
|
| 78 | 80 | } |
|
| 79 | 81 | ||
| 80 | 82 | #[derive(Template)] |
|
| 86 | 88 | rendered_content: String, |
|
| 87 | 89 | favicon_url: String, |
|
| 88 | 90 | og_image_url: String, |
|
| 91 | + | site_url: String, |
|
| 89 | 92 | } |
|
| 90 | 93 | ||
| 91 | 94 | #[derive(Template)] |
|
| 136 | 139 | posts: Vec<Post>, |
|
| 137 | 140 | favicon_url: String, |
|
| 138 | 141 | og_image_url: String, |
|
| 142 | + | site_url: String, |
|
| 139 | 143 | } |
|
| 140 | 144 | ||
| 141 | 145 | #[derive(Template)] |
|
| 518 | 522 | nav_links, |
|
| 519 | 523 | favicon_url, |
|
| 520 | 524 | og_image_url, |
|
| 525 | + | site_url: state.site_url.clone(), |
|
| 521 | 526 | }) |
|
| 522 | 527 | .into_response() |
|
| 523 | 528 | } |
|
| 546 | 551 | rendered_content, |
|
| 547 | 552 | favicon_url, |
|
| 548 | 553 | og_image_url, |
|
| 554 | + | site_url: state.site_url.clone(), |
|
| 549 | 555 | }) |
|
| 550 | 556 | .into_response() |
|
| 551 | 557 | } |
|
| 575 | 581 | rendered_content, |
|
| 576 | 582 | favicon_url, |
|
| 577 | 583 | og_image_url, |
|
| 584 | + | site_url: state.site_url.clone(), |
|
| 578 | 585 | }) |
|
| 579 | 586 | .into_response() |
|
| 580 | 587 | } |
|
| 599 | 606 | posts, |
|
| 600 | 607 | favicon_url, |
|
| 601 | 608 | og_image_url, |
|
| 609 | + | site_url: state.site_url.clone(), |
|
| 602 | 610 | }) |
|
| 603 | 611 | .into_response(), |
|
| 604 | 612 | Err(e) => { |
|
| 5 | 5 | <meta property="og:title" content="{{ blog_title }}"> |
|
| 6 | 6 | <meta property="og:description" content="{{ blog_description }}"> |
|
| 7 | 7 | <meta property="og:type" content="website"> |
|
| 8 | + | <meta property="og:url" content="{{ site_url }}"> |
|
| 8 | 9 | {% if !og_image_url.is_empty() %} |
|
| 9 | 10 | <meta property="og:image" content="{{ og_image_url }}"> |
|
| 11 | + | {% else %} |
|
| 12 | + | <meta property="og:image" content="{{ site_url }}/static/og.png"> |
|
| 10 | 13 | {% endif %} |
|
| 11 | 14 | {% endblock %} |
|
| 12 | 15 | {% block content %} |
| 3 | 3 | {% block meta %} |
|
| 4 | 4 | {% if !og_image_url.is_empty() %} |
|
| 5 | 5 | <meta property="og:image" content="{{ og_image_url }}"> |
|
| 6 | + | {% else %} |
|
| 7 | + | <meta property="og:image" content="{{ site_url }}/static/og.png"> |
|
| 6 | 8 | {% endif %} |
|
| 9 | + | <meta property="og:url" content="{{ site_url }}/pages/{{ page.slug }}"> |
|
| 7 | 10 | {% endblock %} |
|
| 8 | 11 | {% block content %} |
|
| 9 | 12 | <div class="page-header"> |
| 9 | 9 | <meta property="og:image" content="{{ post.meta_image.as_deref().unwrap_or_default() }}"> |
|
| 10 | 10 | {% else if !og_image_url.is_empty() %} |
|
| 11 | 11 | <meta property="og:image" content="{{ og_image_url }}"> |
|
| 12 | + | {% else %} |
|
| 13 | + | <meta property="og:image" content="{{ site_url }}/static/og.png"> |
|
| 12 | 14 | {% endif %} |
|
| 13 | 15 | {% if post.canonical_url.is_some() %} |
|
| 14 | 16 | <link rel="canonical" href="{{ post.canonical_url.as_deref().unwrap_or_default() }}"> |
|
| 15 | 17 | {% endif %} |
|
| 16 | 18 | <meta property="og:title" content="{{ post.title }}"> |
|
| 17 | 19 | <meta property="og:type" content="article"> |
|
| 20 | + | <meta property="og:url" content="{{ site_url }}/posts/{{ post.slug }}"> |
|
| 18 | 21 | <meta property="article:published_time" content="{{ post.published_date.as_deref().unwrap_or_default() }}"> |
|
| 19 | 22 | {% endblock %} |
|
| 20 | 23 | {% block content %} |
| 3 | 3 | {% block meta %} |
|
| 4 | 4 | {% if !og_image_url.is_empty() %} |
|
| 5 | 5 | <meta property="og:image" content="{{ og_image_url }}"> |
|
| 6 | + | {% else %} |
|
| 7 | + | <meta property="og:image" content="{{ site_url }}/static/og.png"> |
|
| 6 | 8 | {% endif %} |
|
| 9 | + | <meta property="og:url" content="{{ site_url }}/posts"> |
|
| 7 | 10 | {% endblock %} |
|
| 8 | 11 | {% block content %} |
|
| 9 | 12 | <h1>Posts</h1> |