How to handle moved/renamed pages links in Docusaurus v2? - docusaurus

#Actito we have our Developers Portal hosted as a Docusaurus v2 website.
We start to work more and more on content, and for consistency/better structure aspects we regularly rework the pages structures/hierarchy
What is the right way to handle those moves without our users facing broken pages (bookmarked) ?
Can we setup something to do with routing so as to store redirections from former links to new ones ?
I would be happy to hear about that
Thanks a lot for your help !
KR,
Marc

You can use the plugin-client-redirect plugin to create redirects. The syntax is straightforward:
type RedirectRule = {
to: string;
from: string | string[];
};
I'm using this and it works OK. The problem is that list of redirects can get quite big over time. You also must take special care of the page that have custom slugs.
If you can do server-side redirects, it would be better to use them.

Related

How to handle multiple title url for seo

I am having multiple list of classes in my application. I'm trying to re-write a URL to every class for seo purpose dynamically.
Here is the rewrite url pattern:
Class title: Web developer with angular
Url: https://www.example.com/web-developer-with-angular
Everything is working fine if I doesn't have duplicate class names. If I got duplicate class names content going wrong.
How can I resolve this duplicate url issues. Can anyone help me?
Can I use titles like below for seo:
Class title-1: Web developer with angular
Url: https://www.example.com/web-developer-with-angular
Class title-2: Web developer with angular
Url: https://www.example.com/web-developer-with-angular-1
Class title-3: Web developer with angular
Url: https://www.example.com/web-developer-with-angular-2
Can anyone tell me, Is this pattern good for seo or not? Or Shall I need to maintain different titles?
Which is better for seo? Please help me and thanks for advance.
You should definitely keep different titles. /angular-web-developer, /freelance-web-developer, /professional-web-developer, and so on. The URL should reflect the contents of the webpage. For example, If the content of the webpage talks about a freelance Angular web developer, the URL should be something like : /freelance-angular-web-developer. A good starting point is to do a little keyword research using Ubbersuggest or Google analytics.

Changing the URL for blogs on Shopify

I was wondering if it was possible to change the default URL for blogs. Our client has recipes and would like it to be mydomain/recipes instead of the mydomain/blogs
If not, is it possible to copy the blog.liquid template and rework that somehow on its own custom page? Ultimately, is there any way to achieve this behavior without having to move the recipes to some other platform?
You can have /blogs/recipes but you can't have just /recipes.
There is no way in Shopify to change this no matter what you try.
If he is concerned about SEO the /blogs/recipes won't affect it or it least it wont affect it as hard as he think.
The best you can do is generate a proxy page with an App and add the products there, but the URL will be something like /a/recipes, which will be an overkill for just an url.
Shopify does not support URL rewrite rules, so the bottom line is - you can't achieve this with only Shopify.
You can create a separate page that pulls the blogs posts from Shopify if this is really important for your client, but once again - it's an overkill.

Passing the arguments to a website

Well the title is tricky. I was not sure if this has been already there and how to put it.
Example:
Lets suppose my site is accessible:
http://mysite.com
if mysite does additions: with 2 inputs
Now If the end user need to pass an argument to site like this (so i load the page like this):
http://mysite.com/argument1/argument2
so it should be able to thus go to the result directly: arg1+arg2
This brings to the question:when user types this, how can i retreive argument1 and argument2 and load my site according to that? Is it possible? If yes, Any client site programming solutions?
Thanks in advance.
Found the solution after searching a lot. The correct term for this process is URL-routing. We can overcome this by using #.
www.mysite.com/#/argu1/argu2
Then in the document.ready() we can read the url in the following manner:
var url = window.location;
More sophisticated way is to use the "backbone.js" for the routing. The documentation on the link explains everything
Backbone.js routing

Hash character in URLs (accessing and redirecting in Apache)

It looks as though this question has been asked in part by some others, but I can't find the answer I'm looking for specifically, so I thought I'd pose my particular scenario in case anyone is able to help.
We have an old website (developed externally by a third party) that is due to be retired and replaced by a new site designed in house. For reasons best known to themselves, the developers of the old site used the hash character as part of the URL for the old site (www.mysite.com/#/my-content-stuff). To assist with the transition and help with SEO I need to set up 301 redirects for the top performing URLs from the old site. As I'm now discovering however, I'm not able to set up a simple redirect in the .htaccess file as I believe it takes the hash character to be a comment and ignores the remainder of the line. I've tried escape characters, using %23 instead, wildcard matching, nothing seems to work.
As a workaround, I wondered about simply creating dummy files with the same paths and URLs as the old site had, then simply creating HTML redirects within them to drive traffic to the correct new pages, but it looks as though the server is doing something similar regarding the hash character in the URL, and ignoring anything afterit. So, if I create a sub-folder on my news server called '#' and create a file in there called 'test.html', I expected to be able to just go to 'www.myNEWsite.com/#/test.html', but it just takes me to the default root file of my site.
Please can anyone shed any light on how I might get around this? I must admit I'm not that clued up on Apache so I'm having to learn a lot as I go.
Many thanks in advance for any pointers or info anyone can provide.
Cheers,
Rich
A hash character in the URL specifies the anchor, and it's not even sent to your webserver. A redirect is impossible on the server side, and the old developer probably did it using JavaScript. Implement fallback URLs without the hash instead, and have a global JavaScript script detect these URLs and redirect automatically.
Hash tags cannot be read by the server. They are regarded as locations within the document and are therefore not exposed to the server. The client is the only one whom see's these. The best you could do is use a "meta refresh" tag, or alternatively, you could use javascript to detect the url, and if its one which requires 301 redirection, use "window.location" to move the user to a full url where mod_rewrite or a php page can issue a 301 header.
However neither are SEO friendly and only really solve the issue for users that click onto an old link via an external site
<!-- Put in head tag so the page does not wait to load the content-->
<script type="text/javascript">
if(window.location.hash != "") {
var h = window.location.hash.match(/#\/?(.*)/i)[1];
switch(h) {
case "something_old":
window.location = "/something_new.html";
break;
case "something_also_old":
window.location = "/something_also_new.html";
break;
}
}
</script>

SEO and hard links with dynamic URLs

With ASP.NET MVC (or using HttpHandlers) you can dynamically generate URLs, like the one in this question, which includes the title.
What happens if the title changes (for example, editing it) and there's a link pointing to the page from another site, or Google's Pagerank was calculated for that URL?
I guess it's all lost right? (The link points to nowhere and the pagerank calculated is lost)
If so, is there a way to avoid it?
I use the same system as is in place here, everything after the number in the URL is not used in the db query, then I 301 redirect anything else to be the title.
In other words, if the title changed, then it would redirect to the correct place. I do it in PHP rather than htaccess as it's easier to manage more complex ideas.
I think you're generally best off having the server send a permanent redirect to the new location, if possible.
That way any rank which is gained from third party links should, in theory, be transferred to the new location. I'm not convinced whether this happens in practice, but it should.
The way Stackoverflow seems to be implemented everything after the question number is superfluous as far as linking to the question goes. For instance:
SEO and hard links with dynamic URLs
links to this question, despite the fact that I just made up the 'question title' part out of thin air. So the link will not point to nowhere and the PageRank is not lost (though it may be split between the two URLs, depending on whether or not Google can canonicalize them into a single URL).
Have your app redirect the old URL via a 301 Redirect. This will tell Google to transfer the pagerank to the new URL.
If a document is moved to a different URL, the server should be configured to return a HTTP status code of 301 (Moved Permanently) for the old URL to tell the client where the document has been moved to. With Apache, this is done using mod_rewrite and RewriteRule.
The best thing to help Google in this instance is to return a permanent redirect on the old URL to the new one.
I'm not an ASP.NET hacker - so I can't recommend the best way to implement this - but Googling the topic looks fairly productive :-)
Yes, all SEO is lost upon a url change -- it forks to an entirely new record. The way to handle that is to leave a 301 redirect at the old title to the new one, and some search engines (read: Google) is smart enough to pick that up.
EDIT: Fixed to 301 redirect!