making it so docusaurus uploads to subdirectory instead of web root - docusaurus

From node_modules\docusaurus\lib\publish-gh-pages.js:
const websiteURL =
GITHUB_HOST === GITHUB_DOMAIN
? `https://${ORGANIZATION_NAME}.github.io/${PROJECT_NAME}` // gh-pages hosted repo
: `https://${GITHUB_HOST}/pages/${ORGANIZATION_NAME}/${PROJECT_NAME}`; // GitHub enterprise hosting.
My question is... why is the documentation being uploaded to a subdirectory? What if I wanted it uploaded to the root directory? How might I do that?
The front page of a docusaurus v1 website is more of a splash page with sections like "feature callouts", etc. Overall, it seems best suited to be a root page as it appears to be for https://hermesengine.dev/ , https://hydra.cc/ and pretty much every other facebook open source project.
Also, the HTML that docusaurus generates has <link rel="stylesheet" href="/css/main.css"/> in it, which works great when you're building your site with npm run start (which results in the files living in web root), but not so much when using publish-gh-pages.js since main.css then lives at /${PROJECT_NAME}/css/main.css.
So how can I do the same - make it so my docusaurus built website gets uploaded to web root instead of a subdirectory?

The repo was that the repo wasn't named project_name.github.io - it was named docs. That this would result in docusaurus doing the build process is evident from the build script BUT apparently github.com itself will default to a subdirectory for github.io unless your repo name is project_name.github.io. This can be seen by scrolling to the bottom of the page that Settings brings up.

Related

My Docusaurus docs multi-instance ended up with two navbar links that go to the same intro.md file, but I don't know why

I'm making a Docusaurus site with two separate sets of documentation. One set of documents is for our website content creators and the other is for site development documentation.
I followed instructions on the Docusaurus site for implementing Docs Multi-instance: https://docusaurus.io/docs/docs-multi-instance
I already have a /docs folder. I created a new /dev folder on the same level. Screenshot: two documentation directories
I installed the docs plugin according to instructions here: https://docusaurus.io/docs/api/plugins/#docusaurus/plugin-content-docs
I have the original docs instance from preset-classic. Screenshot: preset-classic code
I added a line for the additional docs by adding plugin info to the docusaurus.config.js file. Screenshot: plugin code
Both /docs and /dev have a markdown file called intro.md. The site loads but the two nav items both point to the intro.md file that's in /docs.
I changed the name of the intro.md file in /dev to devintro.md. After that change, I don't get an error in terminal, but the content isn't visible on the docusaurus site anymore. I just see the favicon and nothing else.
Here's a screenshot from inspector: inspector view of nav links
Has anyone else successfully gotten a multidocs instance running in Docusaurus? How can I have my nav items point to the landing page within each directory? Am I missing a step?

NuxtJS SPA mode (ssr false) still generates HTML for each vue file in the pages folder

The Nuxt documentation (latest) states that for SPA you need to set ssr: false in nuxt.config.js. Also, every vue file in the pages folder is added to the router configuration, so you don't have to do this yourself. This is both correct and works perfectly, but there is something I really don't understand.
When I run npm run build (nuxt-ts build), it builds the production output of the project and puts in the dist folder (default). I was surprised to see that even though I configured it to be a SPA, it still generates HTML files for each vue file in the pages folder.
It happens with newly generated projects using npx nuxt-create-app as well.
What I'd expect is that it only generates one HTML file (which is index) when ssr is set to false and when I want a static app, I would use npm run generate or set target to 'static' to create HTML files per route.
Nuxt documentation also states this for the target property:
https://nuxtjs.org/docs/2.x/get-started/commands#target-server-default-value (builds output to dist)
https://nuxtjs.org/docs/2.x/get-started/commands#target-static (generates HTML per route)
All I have in my config is ssr set to false, so it should not generate static files (HTML) per page.
What am I missing here, or am I misunderstanding how this works?
Thanks in advance!
Remember that in a static setup, your visitors may arrive at your site via any of your page routes— not just index.html.
For example, they may access https://www.your-app.com/contact-us. If you do not have a contact-us.html file available, and you don’t have a server configured to handle this request (as is the case with universal mode), you’re gonna end up with a 404.
What happens in static mode is contact-us.html is served, which contains the minimum javascript necessary to hydrate your nuxt app, then SPA mode kicks in— giving you client-side navigation.

Is there a way to use Docusaurus just for the /docs directory?

I have an existing website, and just want to use docusaurus to manage the /docs directory (e.g. published as a static site into there). When I follow all the documentation it creates both the docs directory and separate website directory, how can I just have it render /docs when testing locally and only publish that sub-directory when doing a build of the static site?
found the answer in the docs 🤣
https://v2.docusaurus.io/docs/docs-introduction#docs-only-mode

Why am I getting resource 404s on static nuxt.js app hosted on GitHub pages?

I have followed these steps:
Made a vue project with Nuxt.js (tested and working with npm run dev)
Used Nuxt.js static site generation to generate a static distribution under the dist directory of my master repository (also tested using VSCode's Live server plugin, works fine).
Deployed the dist directory to the gh-pages branch using: gh-pages -d dist
In the Options for my GitHub project, which is the GitHub Page for my user (augusto-moura.github.io/), I changed the Source to gh-pages.
The gh-pages branch seems to hold exactly what it's supposed to, but as I open the page, the scripts aren't loaded and each return a 404 eror.
What am I doing wrong? GitHub seems to not be serving the JS files inside the _nuxt directory.
you need to add .nojekyll file at root dir when publishing to GitHub Pages, otherwise it won't get resource files from _nuxt dir.
As indicated in the How to deploy on GitHub Pages? guide, in this tiny, easy-to-miss note...
Branch gh-pages for project repository OR branch master for user or organization site
In order to use Pages for your user account, you need
push-dir --dir=dist --branch=master

gh-pages doesn't show site

I'm trying to create site by gh-pages after I'm run npm run deploy and it created gh-pages branch and when I'm go through the link that give in the sitting this show.
Could anyone tell me what should I do?
Your image shows an URL https://sovannak22.github.com/mywebsite.
That looks like a project pages
A Project Pages site for a personal account is available at http(s)://<username>.github.io/<projectname>.
Don't forget an URL is case-sensitive.
Considering your GitHub account URL is https://github.com/Sovannak22, you should:
have a repo at https://github.com/Sovannak22/mywebsite (which I don't see)
use the URL https://Sovannak22.github.com/mywebsite.