Complete SEO guide for Frontity

I’m creating this new thread because I haven’t found any existing thread that is specific to only SEO related all setup. I would like to collect all SEO/Sitemap related information under the single roof so it can help everyone.

As mentioned in the following guide https://docs.frontity.org/guides/seo

  1. I have already installed REST API - Head Tags WordPress plugin and @frontity/head-tags Frontity package.

  2. My robots.txt file also looks like https://github.com/frontity/frontity/blob/1460e7c03ce3600f4f8ece0d6cf8fadb2bf9b526/examples/mars-theme-example/robots.txt

  3. I have also installed Yoast SEO and added the generated site map to the sitemap like this

    Sitemap: https://wp.example.com/post-sitemap.xml
    User-agent: *
    Allow: /

In the above setup, the sitemap contains links to the actual WordPress posts, not the Frontity one.

In the search engines, only WordPress is getting listed not the Frontity even after having quality content made with the Frase.io.

So, I would like to know what is the correct way of SEO with Frontity.

  1. Yoast SEO/other plugin setup for Frontity
  2. Setting up sitemap for Frontity
  3. Correct SEO setup inside Frontity

To get my sitemap working, I am using the yoast sitemap. I put a link to it inside robots.txt - then I added the following to my functions.php file in my theme (this should probably be in a plugin instead).

function change_urls($entry) {
	$entry['loc'] = str_replace(".rest", ".net", $entry['loc']);
	return $entry;
}
add_filter('wpseo_sitemap_entry', 'change_urls');

My WordPress install and frontend only have a different .rest and .net domain, so I changed that, but you could change whatever you like in the str_replace function.

2 Likes

Hi @Divaksh,

Thanks for your feedback!

In this SEO guide you’ll find how to add some of the key things for having a proper SEO in a Frontity site (meta-tags and robots.txt)

https://docs.frontity.org/guides/seo

Here you have this blog post that may be helpful for understanding how to deal with SEO with Headless WordPress and more specifically with Frontity

We also have in our Roadmap a more detailed section about SEO

There is some more information we have planned to add to that guide. In the meantime here you have another thread where you can find some info related with SEO (how to add XML sitemaps to a Frontity project)

3 Likes

I had a similar Issue when trying to use the head-tags plugin (links to the wordpress site on the head tags). I thought it may help someone in the future when having a similar problem -

I solved it with just updating the URLs in the General Settings on Wordpress to HTTPS instead of HTTP:

http://mywpsite.sample.comhttps://mywpsite.sample.com

I think the head-tags frontity package isn’t updating your links correctly for the frontity site if the URL in the settings aren’t the same as the ones uses in frontity.settings.js (I am using source.api).

@juanma: The Links (to the wordpress plugin and frontity package) on the SEO guide are broken, since you guys moved some stuff to api.frontity.org. I hope the suggested links in the PR are fine

1 Like

@cristianbote can you check this? Maybe it’s a bug that needs to be addresed

PR merged
Thanks a lot for your contribution! :blush:

1 Like