Viewing final Franklin website from __site folder

Noobie website development question. :blush:

I’m experimenting with Franklin and when I do the following commands:

julia> using Franklin
julia> newsite("sandbox_02", template="sandbox")
julia> serve()

I see the following displayed in my browser:

As I understand it, the serve() command has then generated the proper file structure in the __site directory. So I go into __site and double-click the index.html file to open it in my browser, but it looks like this:

image

I’ve gotten the same issue with a site that I’m working on where I’ve heavily modified the template, as well as with multiple templates with no modification, so I figure there’s something really simple I’m doing wrong. Hopefully the example above is clear enough that someone can spot the issue.

you need a server to see things :slight_smile: (this would be the same with any static site generator) this is necessary so that the browser is aware of the CSS and JS that the page may need.

The package LiveServer.jl does this (and is a dependency of Franklin):

julia -e 'using LiveServer; serve(dir="__site",launch_browser=true)'

(of course Franklin does this behind the scene when you call serve)

Hey @tlienart - thanks for the fast response. Digging a little deeper here… so to put the built website at a web address, https://mysite.com, do I simply copy the contents of __site to the ftp address, /home/of/mysite.com/ ?

That’s what I attempted to do with the site I was working on, but it was displaying the same way as simply opening the index.html file without the use of a server. So that’s what led me down this path.

There’s more details here but in short yes, the content of __site is what you want to put on the server.

One thing to note is that there’s two situations:

  1. the base URL is abc.com and the landing page is at abc.com/index.html; in that case you just have to copy paste the content of __site to the server
  2. the base URL is abc.com/base and the landing page is at abc.com/base/index.html; in that case you just have to copy paste the content of __site to the server after having called optimize and making sure that there is a line prepath = "base" in the file config.md

If you’re deploying on GitHub for instance, case (1) is a “personal page” (username.github.io) and case (2) is a “project page” (username.github.io/foobar/)

If you tried deploying by copy pasting the content and saw un-styled content, it’s usually because the prepath is not set properly (again, cf. link at the beginning of my answer).

3 Likes

Thanks so much. I had several bugs in addition to the above but the above was very helpful in assuring me of how Franklin should work so I could look for other issues. I’m so geeked out by how much faster my site loads now. I won’t call out the former product as I’m sure it’s great for many things, but for a simple site it was way slower than I expected. But Franklin is awesome! :smiley:

1 Like