S1SYPHOS / kirby-lingonberry

A Kirby port of the Wordpress theme 'Lingonberry'
https://twobrain.io/lingonberry
GNU General Public License v2.0
6 stars 2 forks source link

opengraph with lingonberry - 'kirby-meta-tags'-example-config #14

Closed demlak closed 6 years ago

demlak commented 6 years ago

Hi, i want to give something back =)

Since i want nice inclusion of my postings/website on social media sites, i was playing a little bit with this nice plugin: https://github.com/pedroborges/kirby-meta-tags

i was able to make a config, which generates nice meta tags for blog posts and for the main-site. i was not able to get deeper into it, so there are still some things missing. for example coverimage for gallery posts. Also videos are not referenced when added in the video template via Embed code. And Kirby-Tags are also not added.

if there is no coverimage, the default site-logo will take place. if there is no page text, then the default site description takes place.

well.. here is my config, that works for example with twitter card validator (as i did not saw any benefit on using twitter-card-meta-tags, i just use opengraph tags)

c::set('meta-tags.default', function(Page $page, Site $site) {
    return [
        'title' => $site->title(),
        'meta' => [
            'description' => $site->description()
        ],
        'link' => [
            'canonical' => $page->url()
        ],
        'og' => [
            'title' => $page->isHomePage()
                ? $site->title()
                : $page->title(),
            'type' => 'website',
            'site_name' => $site->title(),
            'url' => $page->url(),
            'description' => $page->isHomePage()
                ? excerpt($site->description(), 280)
                : (
                    $page->intro()->empty()
                    ? excerpt($page->text(), 280)
                    : excerpt($page->intro(), 280)
                  ),
            'namespace:article' => [
                 'author' => $page->author(),
                 'published_time' => $page->date('c'),
                 'modified_time' => $page->modified('c'),
            ],
            'namespace:image' => function(Page $page, Site $site) {
                $image = $page->coverimage()->toFile();
                return $image
                ? [ 'image' => $image->url() ]
                : [ 'image' => $site->logo()->toFile()->url() ];
            }
        ]
    ];
});
S1SYPHOS commented 6 years ago

While I appreciate the effort you put into this, allow me to justify closing this issue:

Throughout the process of porting the original Lingonberry theme, and up to now, I wanted to stay close to its roots. Whenever I felt that features are missing, I prohibited myself from implementing them - because ultimately adding new features, altering the inner workings of this theme or ripping everything apart to create something completely new, that's people's choice. They are free to do whatever they want with this piece of software, I'm just providing a Kirby-ready, untainted-as-possible version of Lingonberry to begin a new journey with.

That being said, while I'm glad that you like what I did so far, it's totally up to you to implement new features. As far as this starter theme goes, I will not depart from aforementioned decision to stay as close as possible (but also reasonable). Don't be demotivated - suggestions are always welcome.

I admit that drawing the line between staying true and improving where necessary is difficult sometimes, as generally in life. And whenever you have general questions, head over to the Kirby forum and be welcome!

demlak commented 6 years ago

Absolutly no problem =) This thread was just for others who want to extend your great work. Just meant to be a help for those people. It was not meant as a pull request or something similar.

Thx for your great work and your explanation in detail.

S1SYPHOS commented 6 years ago

Mucho appreciado