Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Genarito opened this issue Jan 21, 2020 · 9 comments
Open

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

Genarito opened this issue Jan 21, 2020 · 9 comments
Assignees
Labels

Comments

@Genarito
Copy link

Genarito commented Jan 21, 2020

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 Genarito changed the title gh-pages command not working gh-pages command not working. Showing README.md Jan 21, 2020
@Genarito Genarito changed the title gh-pages command not working. Showing README.md gh-pages command not working. Showing README.md content Jan 21, 2020
@Genarito
Copy link
Author

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 torabisu self-assigned this Jan 21, 2020
@torabisu
Copy link
Contributor

Hey there.

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

@Genarito
Copy link
Author

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
Copy link
Contributor

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 torabisu added the bug label Jan 21, 2020
@torabisu torabisu added this to Backlog in Presidium Core via automation Jan 21, 2020
@torabisu
Copy link
Contributor

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

@Genarito
Copy link
Author

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
Copy link
Contributor

pacomendes commented Jan 21, 2020

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: jware-solutions/geophp-documentation#4 (Your baseurl was not set)
Sample: https://pacomendes.github.io/geophp-documentation/

image

@torabisu
Copy link
Contributor

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
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Presidium Core
  
Backlog
Development

No branches or pull requests

4 participants