I'm working on a website and I want to use ajax for some content, but I'm worried about search engines crawling my site, and I know google and other search engines only see contents that are currently in the DOM.
Question 1
What if I use ajax but the contents also will be available in DOM after requests?
For example, I have a link called "Article 234" with the URL: "https://example.com/?p=234". When the client clicks on the button it will load the contents from that article with ajax but also if the user opens that URL sees the content, is it ok? (I hope you understand it☺).
Something like this:
$("#article-234").click(e => {
// Not redirecting
e.preventDefault();
// Instead, get content with ajax
loadAjax(234);
});
Question 2
I have a page with the lists of articles on my blog, like:
Articles (page 1)
What is Google? [ajax load #1]
What is Apple? [ajax load #2]
What is Microsoft? [ajax load #3]
Articles (page 2)
What is BMW? [ajax load #4]
What is Tesla? [ajax load #5]
What is Ferrari? [ajax load #6]
and I have a pagination section:
[1] [2] [3]
When the client clicks on the pagination buttons an ajax request will send to the server and it will load the article list for that page. I have a sitemap that every article URL is registered but the question is, is it ok to use ajax for the articles list? (but search engines only see the first page)
Sorry if my English is bad :)