Change Vue Router's mode from 'hash' to 'history' #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request changes Vue Router's mode from the default of "hash" to "history." This solves open issue #30 without needing to completely rebuild the documentation as a static site. In effect, this will change the URL structure from https://typeorm.io/#/entities/entity-columns to https://typeorm.io/entities#entity-columns. This URL structure will allow Google to index inner pages of the documentation.
Google currently doesn't index hashed routes, which means it can only see the homepage of the TypeORM documentation. Changing Vue Router to use history mode will allow Google to index the documentation's inner pages, making it easier for TypeORM users to find relevant documentation directly from Google searches.
These changes also include a backwards compatibility layer in the Router to ensure that current documentation links continue to work. You can test this by going to
/#/entities/entity-columns
and seeing the redirect to/entities#entity-columns
.The following changes were made:
index.js
.beforeEach()
instance method was added to the router to handle redirecting the current URL structure to the new URL structure inindex.js
.fragment
tohash
inMarkdownReader.js
because the URL structure now uses a hash.links-replacer
andother-page-links-replacer
converter extensions because the converter uses hashes by default.DocumentPage.js
to usehash
instead offragment
.In addition to improving SEO, these changes will also fix header anchors on the homepage.
Thank you for taking the time to review this, I really appreciate it. This is my first open source pull request and I hope it's helpful.