Webpage not rendering correctly on GitHub pages


I wanted to start my first personal website using Franklin but with no success on rendering my site as it should. I uploaded the default site that Franklin creates because I first wanted to check that all was running fine on GitHub pages.

What I did was create an empty public repo, then synced it with my local directory as mentioned in the docs.

I saw that a prepath is neded in some cases but this doesn’t seem to be my case.

Also, I initialized my site as:

julia> newsite("."; template="lanyon")
✓ Website folder generated at "/home/leo/Documents/projects/leoflotor.github.io" (now the current directory).
→ Use serve() from Franklin to see the website in your browser.

When I run serve() I can see my local webpage and everything seems to be running fine.

julia> serve()
  Activating project at `~/Documents/projects/leoflotor.github.io`
→ Full pass (with pre-rendering)   [done 739.4ms]                                             
→ Minifying *.[html|css] files...  [done 63.0ms]                                              
→ Pushing updates with git...      [done   1.6s]   

Then I followed the documentation shortcut to publish the changes directly from the currently active julia session and the active project:

julia> publish()
  Activating project at `~/Documents/projects/leoflotor.github.io`
→ Full pass (with pre-rendering)   [done 739.4ms]                                             
→ Minifying *.[html|css] files...  [done 63.0ms]                                              
→ Pushing updates with git...      [done   1.6s]  

Hello @leoflotor when things show fine locally but not remotely, the problem is with what you pushed remotely.

In your case, you properly pushed things to gh-pages [1] but the branch that GitHub uses to publish your page is incorrectly set. To set it you should go to the repo settings, click page, and select gh-pages as the source branch for the page. Once you’ve done that, wait a couple of minutes and things should deploy properly. What you see now on your page is just GitHub trying to render markdown (from the main branch).

If after doing this successfully, you think the docs could/should be improved to reflect this, please consider making a PR to the docs. thanks!

[1] btw you shouldn’t do this push manually, on GitHub it’s much easier to use a GitHub action to do this, see this demo repo and its workflow, you should be able to just copy paste stuff maybe updating a couple of things like Julia version and removing Python if you don’t need it).
That being said, even with a GA, you would still have had to select the branch in repo settings.

Thanks! It did work, now it’s up correctly.

The push you refer to is te initial push to the repo? You mean that I can create the repo in GitHub, clone it, and create the site inside my local repo directory with Franklin. And then publish() it, right ?

No I meant that if you’re using GitHub, you should prefer the GitHub action (cf links in my footnote) to the publish function when you want to deploy. If you look into the code though you’ll see that the two do the same thing, except that publish will be deprecated.

The steps on GitHub are:

  • edit stuff locally, check they look good
  • git push changes (or merge) on the main branch of the github repo
  • github action workflow sees the push, runs the site build, generates the content of __site, and puts it on gh-pages to deploy it.