https://www.dendron.so/ logo
Disclaimer, I do not fully understand what it does...
# questions
c
Disclaimer, I do not fully understand what it does, but it might be a problem for me, yes. Given that I do not have any runners on my github enterprise, I was trying to 1. generate the static website locally (by running
dendron publish export
2. copying the output from
.next/out
to
docs/
) 3. configuring gh-pages to read the content from `docs/`folder in main branch. Regretfully, the site is not working (doesn't show CSS, no JS, links are broken) after having set up my
siteUrl:
to be the same url that is generated by gh pages:
https://pages.github.<domain>/<group>/<repo_name>/
. I suspect that the problem might be that
siteRootDir
pointing to docs may be causing it, as there's no docs within docs folder.
j
> 3. configuring gh-pages to read the content from docs/folder in main branch. can you try to point it to the parent folder of
docs/
?
c
I did it, too. And instead of displaying the site, it is rendering the Readme.md file
r
Are you able to inspect the published page (right click inspect) and see if you can work out where the site is trying to read CSS from? That usually gives me an idea of what configuration is wrong where
c
Sure. It's funny, because all the ``section i s greyed. This is what I can see
<link rel="stylesheet" href="/_next/static/css/2a1ea1ae6d4ffa74.css" data-n-g="">
and that CSS file does exist
all js links within the head section point to
/_next/static/chunks/<whatever>
r
Does that exist at the correct relative path? It's been so long since I got this setup I can't quite remember...
c
It does, I'm afraid. I believe I found something funny: I have this on my dendron.yml:
siteUrl: https://pages.github.<domain>/<group>/<repo_name>/
I get into my dendron site from this url:
https://pages.github.<domain>/<group>/<repo_name>/
and I get to see the content without js and css. But here's one issue: If I click on the link of any child page, it will point to
https://pages.github.<domain>/note/<hash>
. As you see, the url is missing the
<group>/<repo_name>/
from it. If I manually add it in the url, the note is displayed, but without CSS
So I tried the following in dendron.yml:
Copy code
`
siteUrl: https://pages.github.<domain>/
    siteRootDir: <group>/<repo>/
Regretfully, running `npx dendron publish export`complains because of siteRootDir
oh, wait. I can see the error! I have two siteRootDir instances in my dendron.yml!
r
Ah wait, I think this was an asset prefix part!
c
Ok, I've deleted the duplicate `siteRootDir`and I made several attempts: 1. `siteUrl: https://pages.github./`&
siteRootDir: <group>/<repo>/
2. `siteUrl: https://pages.github.//`&
siteRootDir: /
3.
siteUrl: https://pages.github.<domain>/<group>/<repo>
with no
siteRootDir
(thus, defaulting to docs/) All of them yield the same result: 1. Missing CSS 2. Links to notes are missing the `/`part.
r
SiteUrl is the main domain, assetprefix is the subpart I think? Unfortunately I just left the job where I set all this up so can't check...
c
thanks! let me try again
sorry, but I'm not sure if I'm understanding, don't
assetsPrefix
refers to any image or file used within the notes?
great, assetsPrefix has solved the problem with broken links, but regretfully, not with css and js
r
Progress! I'm waiting for someone from my old team to let me know what was in the config so I can check, might be an hour or so though
c
perfect timing for me, as I'm to have lunch 😉
thanks a lot @rlh1994 !
r
I had
Copy code
siteUrl: Https://pages.github.<domain>
siteRootDir: docs
assetsPrefix: /<group>/<repo>
c
hi thanks for coming back, this is exactly how I have it now, but I don't get to get CSS nor JS to work 😦 (the path to urls does work now, though)
r
This is once published on GitHub yes? Not you just opening them locally? If so I'm not sure what else to suggest @jyeung any ideas?
c
Yes, it's failing when visiting the page from gh-pages (I understand that links would be broken in a different location)
k
when you visit gh-pages, where does it try to load the assets from?
c
With this dendron.yml config:
Copy code
yml
publishing:
    siteUrl: https://pages.github.<domain>
    siteRootDir: docs
    assetsPrefix: /<group>/<repo>
the css paths are:
Copy code
html
<link rel="preload" href="/<group>/<repo>/_next/static/css/0710c2518b3fd79e.css" as="style">
The notes' links work just fine
the js paths are similar, too:
Copy code
html
<script src="/<group>/<repo>/_next/static/chunks/framework-bb5c596eafb42b22.js" defer=""></script>
k
locally, what do you see inside of the docs folder? does _next/static/css/0710c2518b3fd79e.css exist?
c
in my repo I have
/docs/_next/static/css/0710c2518b3fd79e.css
, so it does exist. However... my gh pages is set to be working within the docs folder, within main branch. This might be causing the issue, althought not 100% sure. 1. Changing gh-pages to be set to root folder within main branch renders my readme file, instead of dendron's site. 2. Editing as
siteRootDir: ""
doesn't seem to be working either.
k
can you send a screenshot of your pages setup?
eg.
c
sure!
k
can you change
/root
to
docs
?
c
sure, it doesn't solve the problem, though
(I've done it before the screenshot)
this is what I get
k
if you look at the network inspector, can you see what urls its failing at?
c
Sorry, I'm not familiar with that. I'll try to create a public repo with a basic vault
probably tomorrow, though
Oh, I see what you meant, now! it's true, the css are not found, and I can't see what's wrong with the url
unless github pages handle folders starting with an underscore differently.
As said, I will put a public repo so you can reproduce it and I'll share it here
Ok, I managed to get it working (this is, replicating the same error). The github project is here: https://github.com/ccamara/dendron-demo
dendron.yml
settings here: https://github.com/ccamara/dendron-demo/blob/main/dendron.yml#L84 Live version: https://ccamara.github.io/dendron-demo/
k
see the issue. github by default will treat your static site as jekyll. since we're publishing using next, you need to create a
.nojekyll
file in the root of the
docs
folder github docs: https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/ example: https://github.com/kevinslin/dendron-demo
c
thank you so much! This indeed fixes the issue. This was driving me crazy!
2 Views