kirby-deprecated-plugins / kirby-seo

51 stars 10 forks source link

Add open graph tags #28

Closed Thiousi closed 7 years ago

Thiousi commented 8 years ago

And possibly Twitter cards tags?

Thiousi commented 8 years ago

This is a start for the seo.php file, but not sure where the content comes from so far... The core seems to do it, I'll have to dig through.

$html['og:title'] = ( ! empty( $content ) ) ?  '<meta name="og:title" content="' . $content . '">' . "\n" : '';
$html['og:description'] = ( ! empty( $content ) ) ?  '<meta name="description" content="' . $content . '">' . "\n" : '';
$html['itemprop:name'] = ( ! empty( $content ) ) ?  '<meta itemprop="name" content="' . $content . '">' . "\n" : '';
$html['itemprop:description'] = ( ! empty( $content ) ) ?  '<meta itemprop="description" content="' . $content . '">' . "\n" : '';
jenstornell commented 8 years ago

I'm not really fond of being bound to a special social media site like Facebook or Twitter. But on the other hand, they are really big.

What I'm also afraid of is that this plugin will turn into bloatware if I keep adding stuff that some people maybe uses,

Right now I think that this feature idea is great, but maybe not for this plugin. Maybe it would be better to separate them?

What I could think of as a good idea would be helper functions, like print the og title in the meta from the seo title.

I saw you wrote something... need to see what it is...

jenstornell commented 8 years ago

Alright, do you mean using existing data or add more stuff in the panel?

Thiousi commented 8 years ago

I mean to use the same existing data you have already. Basically, a helper function would be great like you say. I really like your field in the panel as a way to define the values, but it's forcing me to echo with the html tags. I'd like the option to echo the raw value so I can use it in different tags!

jenstornell commented 8 years ago

I agree that helper functions would be great!

Maybe this works in the meantime? It's possible str_replace the string to remove <title>. Ugly as hell, but should work.

<?php echo seo('title', array(), true); ?>
<?php echo seo('description', array(), true); ?>

Update

It should not wrap any html with the true value.

Update 2

It's been a while so I don't remember all I did with this field. A little rusty.

Thiousi commented 8 years ago

I see, I missed that in the doc.

luxlogica commented 7 years ago

I think this issue can be closed?...