The simpler media website CMS
Can you advise ?
I have a couple of questions regarding the best way to get my meta description on pages.
At the moment, I am using a codeblock for writing the meta description, on all pages, images and albums.
However if no description has been entered, the attribute is blank.
Is it possible to use the opening sentence of the content if nothing has been entered in the codeblock?
Or is there a plugin that can do this or something similar?
I am using an oldish zenpage but fairly up to date with zenphoto core Zenphoto version 1.4.14
I was also hoping to add page title meta of
e.g. add code block, add page title if empty
Also, my homepage is using a different template and this is not recognising either printCodeblock or printPageCustomData so I have to hardcode it on the home page which is not ideal.
What should I be using here if that is incorrect?
thanks for any pointers.
Comments
You are referring the the
<meta>
element within the page<head>
?I am not sure what you exactly are asking.
The official
html_meta_tags
plugin automatically uses the content of the item, so descriptions on images and albums (and the main gallery page the gallery dessriptions) and the content of pages, articles and categories. I have to look but I think it uses the general gallery descriptions if the item itself has no text content.If you don't use this plugin you need to do it all yourself via the theme code, manually so to speak.
Yes I am referring to the element in the page .
I have tried the plugin HTML_meta_tags - it takes the first sentence of the page content, but I would like the option to manually add a meta description.
So I would like it to work the other way round.
I have coded my theme to use
" />
Ideally this would be conditional, so if nothing was entered in the codeblock, the first sentence of the content would be used.
Is something like this possible?
My other problem is that my home page is not recognising my content in the codeblock.
My homepage template uses the above code for the meta description, but it is not working.
Any idea how I could fix this?
Many thanks!
In the same way, I think something is missing with
html_meta_tags
plugin.If we are on an image page, we have
<meta>
data likeBut If we use images of the gallery in a news (by using ZP plugin of TinyMCE), there is no
<meta>
data about these pictures. There are only<meta>
data about news itself.when I want to share that news on social media like FB, pictures are not "read" by FB and then they are not shown by FB.
So I have a lot of troubleshoot to share news on FB.
Apologies - I meant to say <meta> element in the <head>
And I meant to add the following tag after
I have coded my theme to use....
<meta name="description" content="<?php printCodeblock(2); ?>" />
@vincent3569
Yes, of course not because the current "page" or "item" is the news article and not the image(s) within. That's how FB & Co work, they use the current url (and ofcourse the info within the opengraph elements if available or often just the first image found). The plugin does not and cannot know about images statically embedded into an articlce or page or what you would like.
If you want to share images with their own url on these services, you need to share the actual image page.
@lainyrache
Yes, that is a way if you need to use another page. You can still use the html_meta_tags plugin for all other pages but you need to disable its description field to not get a double one. And of course you need to do this manual part on any page then, too.
news sharing on FN does not work well at this time.
FB does not find the main image (the 1st one) of the news because there is no
<meta>
opengraph for this image.I have to go through an FB debugging tool (https://developers.facebook.com/tools/debug/) to generate a pseudo
<meta>
opengraph from the url of my news. the news is then cached on FB and when I share it, it uses the data of the cache and correctly shows the image that I want to show.an interesting feature for zenphoto would be that the
html_meta_tags
plugin should scan the news/pages and should generate<meta>
opengraph on the images found on the news/pages.Thanks Acrylian.
That's clear about the plugin now.
My issue now is getting codeblock content to appear on my home page.
My home page is using a different template from all other pages and any content I add to a codeblock is not being called to the page.
Can you think of any reason for this?
Are you using the printCodeblock() function where you want it to appear?
Yes I am. The code is exactly the same as on my pages.php file where it works fine.
printCodeblock
context senstivie to the current object (album, image etc). On index (homepage) there is no direct "item" beside the gallery itself in general so you need to tell the function what object's codeblock you want by setting the 2nd parameter:https://docs.zenphoto.org/function-printCodeblock.html
Basics of the object model which lies under everything is explained here:
https://www.zenphoto.org/news/zenphotos-object-model-framework/
It's a bit advanced stuff perhaps.
Thanks Acrylian, I got around this by simplifying the templates and using the default template for the homepage. So I think I've got it sorted now.
Thanks for the advice!