Just like search engines, Facebook scrapes metadata information from your Joomla site. This metadata includes the description, title and image, as we explained in a previous post.
You can control the metadata that Facebook scrapes from your page.
In this post, I'm going to show you how to control how your site shares metadata with Facebook. Let's start...
Step #1. Edit the template file
This step may depend on the template you’re using.
Note: If you are using a template that may get updates later, please consider creating a copy of the template so you can work your customizations on your own copy. This tutorial will help you to understand this process.
- In the Joomla administrator, go to Extensions
- Templates
- Templates
- Click your template details and files
- Edit the file index.php
- Before closing the head tag, add these meta tags replacing "your-full-facebook-page-url" with the full URL of your own Facebook page:
<meta property="article:publisher" content="your-full-facebook-page-url" />
<meta property="article:author" content="your-full-facebook-page-url" />
We're using the Joomlashack Facebook page as anexample. This is how would look in our end:
- Click save and close when you're done.
Step #2. Test your site’s URL through Facebooks sharing debugger
When you share a URL for the first time, Facebook saves the page details. If you later decide to update the content of your Joomla site and share the URL again, those changes won't be reflected.
You need to tell Facebook to scrape your site to get the new information from the new meta tags.
- Go to Facebook sharing debugger site.
- Paste the site's URL.
- Click Debug button.
Scroll down to preview the result to check if the author information was replaced with a link to your Facebook page.
In the example above the correct data doesn't show, we need to click theScrape again button. This forces Facebook to crawl the page again and find the new metadata from our site.
This time our changes were reflected. From now on, every time anybody shares the same URL on Facebook, a link to your Facebook page will be added.
Step #3. End result
- Copy the URL of your public site.
- Paste it as a new post in Facebook.