Add additional pages to wordpress yoast seo sitemap xml programatically - php

I have a stragne question, I have been gogoleing for a while, but have found no answer.
I have a Wordpress site where the Yoast Seo plugin has been installed, titles, descriptions have been added, I could also manage to change the title tag, canonical url generated by it with the wpseo- filters.
The sitemap xmls are also generated fine, but I would need to add additional pages to it.
We have a search page on the site, we search by a rental custom post type.
Rentals can be searched by location.
The search page is eg.: /rentals.
We have found, that there are several sites (I can show you one in hungarian, but I'm sure you will get it) where the search results are indexed by google.
Like this one:
https://www.trivago.hu/?iSemThemeId=8302&iPathId=36103&sem_keyword=hotel%20p%C3%A1rizs&sem_creativeid=187836310244&sem_matchtype=b&sem_network=g&sem_device=c&sem_placement=&sem_target=&sem_adposition=1t3&sem_param1=&sem_param2=&sem_campaignid=242651542&sem_adgroupid=15360737662&sem_targetid=kwd-4821159859&sem_location=1007624&cip=3612001012&gclid=CjwKEAjwoLfHBRD_jLW93remyAQSJABIygGpWkl9XD9HJ7G8ZC7NbJ93ygmeFVxpZcici062NnMlgRoCkNfw_wcB
You get to this page if you search hotels paris. If you have a look at this page, this is already a search result, search parameters are set.
Now we would like to do the same with the Wordpress site.
I have done a redirection for the urls:
/rentals/budapest
/rentals/hungary
... there are more locations.
so they go to the rentals page, where I set the search parameters, I have changed the canonical urls of these pages, but I would like to add these pages to the xml sitemap also.
The problem is that these page do not exist in the database.
Is there a filter that I coul use to add these pages to the sitemap.xml in Yoast Seo plugin?
Has anyone done a similar thing in wp?
Any help is appreciated, thank you!

I have found the answer!
There is a wpseo_do_sitemap_ filter, I had to use that one. Also, This filter only created a custom sitemap, I also needed the 'wpseo_sitemap_index' filter to add my custom sitemap xml to the sitemaps index page.
Detailed solution was found under this link!
https://gist.github.com/mohandere/4286103ce313d0cd6549

Related

Removing / Disabling Wordpress date and /blog links

Solution:
The problem was actually SEO Yoast. It creates "Archives" for posts and authors, creating a whole load of crap on the website.
The current template for our wordpress website originally was html only.
A guy we hired some time ago, did the transfer so to speak, but there are some problems.
At the moment the website contains "www.website.com/blog" and various "www.website.com/2018 or /2018/06" links that google does it's damnedest to index. Some of the links return a 404 occasionally as well.
Because we do daily blog post's everything is naturally copied over to those "/blog" pages. The results is 52% duplicate content (according to Siteliner)
I'm writing here looking for advice, because I don't know how to get rid of them or how to manage them to reduce the SEO related impact. I also didn't find post relating to this specific problem.
(example of the problem "multiorders.com/2018/07/page/2/" )
Our post links are set to website.com/sample-post, someone had suggested adding a "RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://yourwebsite.com/$3" into the .htaccess file.
I can tell you the basic structure to avoid the Duplicate content issue and the URL structure issue. Both are really important and can say main factor for Seo purposes.
Structure:
First one, Create a blog page (Already created on your website). On that page there must be shown the all blog posts that you have entered in the admin panel at POSTS menu. The lists of all blogs www.example.com/blog here as you said. In that page there should me pagination that means if you are showing 10 posts per page then the 11th post will be on the www.example.com/blog/2 and so on. (acceptable foe seo purpose).
Secondly, If someone clicks on the post or Read more button it should redirect the
single blog www.example.com/blog-post-name (perfect for seo).
To change the permalink (URL Structure) you have go to the admin settings menu -- permalink menu-- change to post name and Save.
Note: Take a backup before applying
Any questions, please ask..!!
The problem was actually SEO Yoast. It creates "Archives" for posts and authors, creating a whole load of crap on the website. As soon as I disabled those features all the extra pages vanished. Now all I need is to wait for Google to catch up.

Yoast SEO Plugin not recognising content from the Wordpress Template

I have developed a Wordpress website recently and used all the contents in the template itself. And all the pages and posts fields of WP admin is empty lacking content.
So my content is present in my template and not in the post and pages field.
I used Yoast SEO for this website and when checking with pages in WPadmin. No content is recognized and thus my SEO score is very low. But my content is present in the template which will be displayed in live also.
Example: I want to optimize home page and let the content be 300 words present along with template itself. No when i use Yoast plugin it is not recognizing the content from the template and says: " there is low volume of content in the home page" like this.
Can any one suggest me in solving this.
thanks
Yoast SEO can only give you a score based on DB content that it can read. That being said, just because Yoast SEO can't see your content doesn't mean that search engines can't. Unfortunately, unless you get your content out of the template and into WordPress, your Yoast score will never improve.
I'd recommend (if possible) to try to get that content into WordPress. It's just not best practice to hard-code content into template files. Consider using Custom Fields if you have specialized content that won't work in the WYSIWYG.

Wordpress: Adding meta values like title and description for Pages from custom database

I have a plugin that creates plugin specific database table rows that then are turned into pages. I have got this work with URL redirect and have been able to lay out the page. Now I am having some problems.
Problems:
Creating header title for the page. It currently shows page not found.
Creating description for meta SEO. Meta description is currently blank.
Showing these custom created pages to be added in WP menu.
I know these are not pages, and I have lost most of the wp functionality by doing this and not using custom post types but one of the main requirements of the clients was that the database have separate tables for their data.
I need some help or reference regarding these problems. Links for examples and articles would do or any free plugins that actually do this.
I'd really appreciate the help.
As you mentioned your self, using your current technique you will not able to take advantage of WordPress in real sense. You may use custom posts and then use wp cron to copy get the data from there to your own table.

Joomla SEO Friendly URL Problem

In my current Joomla Project, I set the SEO friendly in URL in global configuration in Joomla 1.5. Everything worked fine except the search. When I search something, the url shows as old one (not like seo friendly url) and because of that, I had a banner image in search result page, and it's not showing now. Does anyone know how to fix the seo friendly url in Joomla Search. Please it kinda urgent.
Thanks
Most likely you need to make a menu item that links to the Joomla search page. Otherwise there is no itemid to associate the search results to. If you don't already have a hidden menu, simply create a new menu and don't put it in a module, then add a link to the default search page. That should solve your problem.

Magento filters url rewrite

I've got one task about Layer Navigation block on site, powered by Magento.
We want to make a SEO friendly URL's in filters:
Now there are links like
mymagazine.ru/category/subcategory1?manufacturer=1926
As you see - manufacturer=1926 is a GET-parameter, which just filter the products.
So I need to make this link like
mymagazine.ru/category/subcategory1/my_manufacturer
Where "my_manufacturer" is an allias to "?manufacturer=1926".
There is one way to do this task: we can make allias for all the filter pages manually with the Magento admin. But the site got a great catalloge, so this would be too tedious. I thought, that this extentions could help me, but not in my practice...
Yoast-landing-pages
Fishpigs_attribute_splash_page
If you have any thought about this problem, I would love to hear them.
Thank's for your attention!
What I did on my store is tag those links in the layered navigation with rel="noindex,nofollow" and I put the same into the robots meta tag in the target pages. I didn't want every variation of the pages to be indexed as I don't want duplicate content. Each variation of the category pages from that layered navigation ends up having the same title, meta description, and often many of the same products.

Categories