0

Using the WP-RestAPI to pull a wordpress blog into an angularjs application. Works extremely well. The blog is using Yoast SEO for the for meta descriptions and keywords. I would like to use the yoast xml sitemap as well for submitting to google. However, because of route structure I need to save the sitemap to a different location than the root wordpress folder. I have also tried using the Google Sitemap Generator plugin. With neither plugin can I seem to change where the sitemap is saved. Looking for any advice on how I could make this work.

  • 1
    I don't think you're supposed to put your REST API endpoints into a sitemap, they're not intended for human consumption ( REST endpoints return data, not HTML ), and sitemaps are for human readable pages, aka pages that show up in google. If I've misunderstood can you please edit your question to clarify what you meant, including examples – Tom J Nowell Oct 12 '16 at 21:18
  • That's not what I'm trying to do. The actual website url is www.mywebsite.com. It contains the application and pulls in and displays the blog via the rest api. The wordpress url is wordpress.mywebsite.com. That is not accessable to the out side world. However I would like to use the site map either plugin creates for all my pages. however neither plugin can write to the www.mywebsite.com directory – jppower175 Oct 12 '16 at 23:39
  • So your pages don't exist in WordPress, they're entirely within the realm of javascript, and populate themselves via REST? – Tom J Nowell Oct 13 '16 at 2:16
  • @jppower175 Could you tell others how you got the meta desc and keywords from the Yoast SEO to a REST API endpoint? Thanks. – Kano Feb 27 '17 at 13:02
  • 1
    @Kano The only data from Yoast I am using is the meta description, keywords, and SEO title. All of which are stored as meta data. All other SEO elements are handled via custom fields or in the front end for my application. I suggested starting your own question that has some examples of what you are trying to do as I am not entirely sure. – jppower175 Mar 7 '17 at 18:00
1

Let's assume your plugin is writing to the /usr/share/wordpress/sitemap_index.xml filesystem location, but you want it can be accessed through http://www.website.com/sitemap_index.xml as if the xml file were stored in /var/www/html/sitemap_index.xml. You can use the alias directive then, available in mainstream webservers Apache and NginX:

For an alias in NginX, you put this inside the server of your public website:

location /sitemap_index.xml {
    alias /usr/share/wordpress/sitemap_index.xml;
}

For Apache the alias it's like this, inside the virtual host of your website:

Alias "/sitemap_index.xml" "/usr/share/wordpress/sitemap_index.xml"

Again, I'm only assuming filepaths and filenames, but if you need more specific directives, for another webserver, or differente paths/names, please comment it, or even better: update your question to make my answer match.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.