• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Answered Set custom og:image for CAS Index page.

Solution
Ah, there is no option for that. Setting an OG image for an INDEX page of any kind, would require custom development (template edit(s) php code modification (especially of there is any LD structured data involved which is normally handled via php in an Entity.

With that said, you should be able to just edit the xa_cas_index template and add arg-imageUrl param to the metadata MACRO and pass in a link to a static image. That param is what is used to pass in an image source to the Core XF metadata_macros template.

btw, Category pages on the other hand, DO set an OG image when you set a Category image.

You might want to search at XenForo.com as what you want to do would be the same with Forum Home, Forum Pages...
The system sets a cover image using the first uploaded attachment to a given classified ad. If the ad does not have an uploaded image, the system checks to see if the Category that the Ad is in has a Category Image. If not, then it uses a background color for Grid View and Tile View layouts (and Avatar for List View).

The "Set cover image" function is in the Ad Tools dropdown and lets the ad owner (or staff) choose one of the uploaded image attachments :)

btw, this is NOT setting the OG Image. The OG image is determined in the same way however. If an Ad has a Cover Image, that cover image will also be set as the OG image for uses like Twitter Card, Facebook etc.

Selection_002.png


Selection_005.png
 
Thank you, but I meant not for ads or ad categories. I meant set cover image for main classifieds page. In my case for this page -https://forum.travmatik.com/classifieds/

 
Can you take a screenshot and circle or draw lines to what you are asking as I do not understand your question as there is no such thing as a "Cover image" for the index page.

There is a Cover Image for an Ad, and it is used to display on Tile View Layout Type, Grid View Layout Type and List View Layout Type, which are used to display ads on listing pages.

For example, this is the CAS Index page configured to display Ad in Tile View Layout Type. Layout Types use the COVER IMAGE of an Ad or the Category Image if there is no image attachment uploaded to the Ad or in the case of Tile View, a background color when there is no cover image or category image for the Ad.

Selection_006.png
 
Untitled-3.jpg

I need to set a custom image for main page that will be appears when users will share this page in social networks.

Sorry, but English not my native languge!:(

Untitled-4.jpg


page link
 
Last edited:
Ah, there is no option for that. Setting an OG image for an INDEX page of any kind, would require custom development (template edit(s) php code modification (especially of there is any LD structured data involved which is normally handled via php in an Entity.

With that said, you should be able to just edit the xa_cas_index template and add arg-imageUrl param to the metadata MACRO and pass in a link to a static image. That param is what is used to pass in an image source to the Core XF metadata_macros template.

btw, Category pages on the other hand, DO set an OG image when you set a Category image.

You might want to search at XenForo.com as what you want to do would be the same with Forum Home, Forum Pages etc... also,maybe log into my private development site and search there as license holders over the past 15 years have shared quite a few customizations, and one of those might be setting an OG image for an Index (would be the same for any addon's index page, so its not addon specific).

Hope that helps and gets you pointed in the right direction :)
 
Solution
Code:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$xf.options.xaCasMetaDescription}"         
    arg-canonicalUrl="{{ link('canonical:cas', null, {'page': $page > 1 ? $page : null}) }}"
    arg-imageUrl="{{ link('https://forum.travmatik.com/zbroya-rinok.jpg') }}" />

Thank you. It works.
 
  • Like
Reactions: Bob
Untitled-5.jpg

Maybe it would be helpful fo someone! I changed arg-twitter Card="summary" to arg-twitter Card="summary_large_image" in template: metadata macros for more attractive snippets.

Code:
<xf:macro name="metadata"
    arg-siteName=""
    arg-title=""
    arg-description=""
    arg-type=""
    arg-shareUrl=""
    arg-canonicalUrl=""
    arg-imageUrl=""
    arg-twitterCard="summary_large_image">
 
You should NOT change default arg values in Core XF Macros. The default value is default for a valid reason (and is expected to be what XenForo sets the default value to be).

Instead, you should pass the value summary_large_image via the arg-twitterCard, so that you are only forcing that value when you are including an appropriately sized image, otherwise Twitter will reject it and no image will be displayed as it doesn't conform to their image size standard for their summary large image.

Just like adding the custom image url via the arg-imageUrl like you did for for CAS index, you can force the twitter card size via the arg-twitterCard as shown below :)

HTML:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$xf.options.xaCasMetaDescription}"       
    arg-canonicalUrl="{{ link('canonical:cas', null, {'page': $page > 1 ? $page : null}) }}"
    arg-imageUrl="{{ link('https://forum.travmatik.com/zbroya-rinok.jpg') }}"
    arg-twitterCard="summary_large_image" />
 
You should NOT change default arg values in Core XF Macros. The default value is default for a valid reason (and is expected to be what XenForo sets the default value to be).

Instead, you should pass the value summary_large_image via the arg-twitterCard, so that you are only forcing that value when you are including an appropriately sized image, otherwise Twitter will reject it and no image will be displayed as it doesn't conform to their image size standard for their summary large image.

Just like adding the custom image url via the arg-imageUrl like you did for for CAS index, you can force the twitter card size via the arg-twitterCard as shown below :)

HTML:
<xf:macro template="metadata_macros" name="metadata"
    arg-description="{$xf.options.xaCasMetaDescription}"      
    arg-canonicalUrl="{{ link('canonical:cas', null, {'page': $page > 1 ? $page : null}) }}"
    arg-imageUrl="{{ link('https://forum.travmatik.com/zbroya-rinok.jpg') }}"
    arg-twitterCard="summary_large_image" />

Super!!! Thank you. DONE!
 
  • Cool
Reactions: Bob
Back
Top