This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Change Vue Router's mode from 'hash' to 'history'#36
Closed
tylerlwsmith wants to merge 1 commit intotypeorm:masterfrom
Closed
Change Vue Router's mode from 'hash' to 'history'#36tylerlwsmith wants to merge 1 commit intotypeorm:masterfrom
tylerlwsmith wants to merge 1 commit intotypeorm:masterfrom
Conversation
Author
|
After testing a bit further, I realized this change doesn't gracefully handle 404 errors. There's a proposal to support single page applications on GitHub pages, but it doesn't look like it's implemented yet. I'm closing this pull request for now. I'd can reopen if GitHub pages supports this SPAs in the future or the documentation moved to a site like Netlify that's set up to handle single page apps. |
giladgd
added a commit
to giladgd/typeorm.github.io
that referenced
this pull request
Mar 24, 2022
…arch engine indexing In order to support loading a deep url without getting a 404 error, a custom 404.html page is implemented to redirect back to index.html which uses history api to load the original url without a refresh. Based on typeorm#36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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-columnsand 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.fragmenttohashinMarkdownReader.jsbecause the URL structure now uses a hash.links-replacerandother-page-links-replacerconverter extensions because the converter uses hashes by default.DocumentPage.jsto usehashinstead 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.