SPANDigital / presidium

Presidium user documentation
http://presidium.spandigital.net
Apache License 2.0
28 stars 3 forks source link

gh-pages command not working. Showing README.md content #186

Open Genarito opened 4 years ago

Genarito commented 4 years ago

Hi, I've cloned this template repository. I've added my custom documentation content. Now I'm trying to deploy my repo running npm run gh-pages, but when I open my github page It's showing the README.md file's content.

I'm looking your User documentation repository and I see that on your branch gh-pages you only have the dist folder content. It's an error of the gh-page command or I should push the dist content on my gh-pages banch? The command is pushing all my current branch content to that branch, so I don't understand how It could work.

When I do a clean example it puts the .versions content folder in gh-pages branch, but the styles and Scripts seems to be not working.

Steps to reproduce the last problem:

# Clone Template repo and installs the dependencies
git clone https://github.com/SPANDigital/presidium-template-design.git
cd presidium-template-design/
npm i && npm start # Checks that works

# Starts a new clean repo
rm -rf .git 
git init
git remote add origin <new repo URL>
git add . && git commit -m "Initial commit" && git push -u origin master

# Create gh-pages
git branch gh-pages
npm run gh-pages
git push -u origin --all

Here you can appreciate the result. You can check the code here.

Thanks in advance and sorry about my English.

Genarito commented 4 years ago

Even creating an orphan branch with git branch --orphan gh-pages, removing everything except dist/site folder and putting its content at the root project, It doesn't work. You can see here. It fails on loading Presidium and links don't work either.

torabisu commented 4 years ago

Hey there.

Gonna run through the steps to reproduce, and see if I can find out where the issue is...

Genarito commented 4 years ago

Cool! Thank you so much! I've updated the presidium-core dependency to its latest version (0.1.46) and re-run npm run gh-pages with the same result.

torabisu commented 4 years ago

Hey there.

Looks like there's been a change in gh-pages, so we will update presidium to accommodate. In the meantime, to get my test working, I used the orphan approach. There's nice instructions here:

https://gohugo.io/hosting-and-deployment/hosting-on-github/#deployment-of-project-pages-from-your-gh-pages-branch

If you follow the above instructions, replace hugo, with npm run build, replace the public folder with dist/site, and their upstream remote, replace with origin (Which I'm assuming is your github remote).

In short, the rendered site lives in dist/site, and you pointing gh-pages to that folder.

As soon as we have a permanent fix to our gh-pages deploy script, we'll push up and bump up the version.

Also remember, you'll have to change your baseurl in _config.yml to reflect the github pages path, so /username/project/.

Let me know if you need any other assistance in the meantime.

Trav

torabisu commented 4 years ago

@ruaanvds I added you to this thread, will ping you in the morning on status update.

Genarito commented 4 years ago

Ok! I'll try! I realised that when you use the template https://github.com/SPANDigital/presidium-template.git the command gh-pages fails on putting the .versions content on the target branch and occurs the README.md content problem. But with https://github.com/SPANDigital/presidium-template-design.git there is not such problem, the script problem happenes instead as the steps in my original question show. So there are 2 problems here, each of them with differents templates.

Hope It helps

pacomendes commented 4 years ago

Alternative solution to gh-pages is to publish public docs to a /docs directory which is simpler than another branch: "gh-pages": "rm -fr docs/;mkdir docs;npm run clean;npm run build;cp -r dist/site/ docs/"

See: https://github.com/jware-solutions/geophp-documentation/pull/4 (Your baseurl was not set) Sample: https://pacomendes.github.io/geophp-documentation/

image

torabisu commented 4 years ago

Good point @pacomendes , fairly easy for us to change the deploy dir... Much easier than an orphaned branch on dist/site... Just the rendered files in doc/

Genarito commented 4 years ago

Thank you really much @pacomendes ! That worked like a charm! I had to remove the mkdir docs part in command because it was creating a site folder when the cp -r /dist/site docs/ was executed.

It would be very cool to change the default behaviour as @torabisu proposed since we don't need to create another branch to make things work.

Thank you again, for the solution, and for this framewok!