Say I have an angular app that defines the following path.
{ path: ':lang/journal/:id/:title', component: JournalComponent, runGuardsAndResolvers: 'always', resolve: {journalOverview: JournalOverviewResolver} },
The resolver JournalOverviewResolver
makes a request for the page details. This http request really only needs the :id
url parameter to get the desired response. This means that visiting the url: www.mywebsite.com/en/journal/12/the-actual-title-of-journal
will load the page, but the url www.mywebsite.com/en/journal/12/dslfjslishshsdkljf
will also lead to that same page.
I don't want to allow this. Only one url can be valid. So when the last path segment is different to the actual title of the journal i want the app to automatically change the url thats in the browser. I use the following for that.
import {Location} from '@angular/common'
constructor(private location: Location)
{
}
changeCurrentUrl()
{
let parts = window.location.pathname.split('/');
parts[parts.length - 1] = actualJournalTitle;
this.changeUrl(parts.join('/'));
}
changeUrl(url: string)
{
this.location.replaceState(url);
}
This works great but i am wondering what kind of impact this has on SEO. If the google crawler crawls an url with an invalid title path segment, and the path segment is automatically changed by the app, will the google crawler pick this up? Or will the google crawler still see the invalid url as the actual link to that page?
I know that this website (stackoverflow) also automatically changes the url of a link if its invalid. Just take this SO question for example: https://stackoverflow.com/questions/32939620/this-is-not-the-correct-title
. When visiting that page the last part is automatically changed into password-finder-something-like-bruteforce-java
. I assume the website simply changes the url instead of redirecting. But does the google webcrawler pick something like that up?