Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

(WIP, NO MERGE) routerMode:history for the docsify site#1968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
trusktr wants to merge3 commits intodevelop
base:develop
Choose a base branch
Loading
fromrouterMode-history-for-website

Conversation

trusktr
Copy link
Member

@trusktrtrusktr commentedJan 22, 2023
edited
Loading

Summary

This allows us to deploy the Docsify site to a static server that handles unknown URLs with a default404.html page, for example GitHub Pages.

As an example,https://docs.lume.io is published on GitHub pages. Notice that the URLs are inhistory mode, and you can refresh the site while on any path, and it works. Pushing to the github repo automatically updates the deployment using thisGitHub Actions file.

What kind of change does this PR introduce?

Repo settings

Docs

For any code change,

  • Related documentation has been updated if needed
  • Related tests have been updated or tests have been added

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

Related issue, if any:

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE (nope!)

@vercel
Copy link

vercelbot commentedJan 22, 2023
edited
Loading

The latest updates on your projects. Learn more aboutVercel for Git ↗︎

NameStatusPreviewCommentsUpdated
docsify-preview✅ Ready (Inspect)Visit Preview💬Add your feedbackJan 26, 2023 at 6:39AM (UTC)

@codesandbox-ci
Copy link

codesandbox-cibot commentedJan 22, 2023
edited
Loading

This pull request is automatically built and testable inCodeSandbox.

To see build info of the built libraries, clickhere or the icon next to each commit SHA.

Latest deployment of this branch, based on commit2da44fa:

SandboxSource
docsify-templateConfiguration

@trusktr
Copy link
MemberAuthor

Nice, the deployment works fine with it! F.e.https://docsify-preview-ll3a2gp9v-docsifyjs.vercel.app/markdown

@trusktrtrusktr changed the title(WIP, DO NOT MERGE) routerMode:history for the docsify siterouterMode:history for the docsify siteJan 22, 2023
@trusktr
Copy link
MemberAuthor

Old bookmarks will still work fine. Try the following (with a hash):https://docsify-preview-ll3a2gp9v-docsifyjs.vercel.app/#/language-highlight

@trusktrtrusktr changed the titlerouterMode:history for the docsify site(WIP, NO MERGE) routerMode:history for the docsify siteJan 23, 2023
@trusktrtrusktr marked this pull request as draftJanuary 23, 2023 01:19
@sy-records
Copy link
Member

sy-records commentedJan 23, 2023
edited
Loading

Edit: seehttps://docsify-preview-git-routermode-history-for-website-docsifyjs.vercel.app/quickstart

It works fine, but doesn't seem to show 404.

image


Great job, but it seems that when using a browser to view the source code, it is a 404 page code, is this normal?
image

@trusktr
Copy link
MemberAuthor

trusktr commentedJan 26, 2023
edited
Loading

Ah, you found an issue! There's actually two things happening in your screenshot:

1) For the vercel deploy, it is not using the 404.html trick, it is using vercel.json to rewrite URLs on the server. So for a path like/notexistspage, it sends back the content of/index.html. Here's a screenshot that shows status code 200, withindex.html being returned:

Screenshot 2023-01-25 at 10 33 21 PM

What we can do is update thevercel.json so that it will not rewrite a URL if it ends with.md, that way the client will receive404 and will know what file to look for.

2) Fordocsify.js.org this is deployed on GitHub Pages, which behaves in a different way: the 404.html page is needed on GitHub in order to redirect to the root/ path, then our Docsify JS code can load the content. Without this,routerMode:history won't function on GitHub Pages.

So, for vercel, the 404.html stuff is not needed, it is only for GitHub, and doesn't have the issue that Vercel does.

For Vercel, I'll update vercel.json so it'll do what we want with the.md lookups.

I've been experimenting onhttps://docs.lume.io. I'll bring back what I learn from there.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sy-recordssy-recordsAwaiting requested review from sy-records

@Koooooo-7Koooooo-7Awaiting requested review from Koooooo-7

At least 2 approving reviews are required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@trusktr@sy-records

[8]ページ先頭

©2009-2025 Movatter.jp