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

I came across this issue because it reflects one of my problems.

I’ve seen a few user guides written in HTML format, which have pages like “ch1.html” and so on. When you click any of those pages, they are not as plain as the one shown by the original poster, containing different heading styles, different fonts and highlighting for code, etc. They also contain hyperlinks to other files, like “ch2.html” and “table-of-contents.html” and they also feature some probably basic CSS.

Instead of always requiring a server, specially for these types of interactive manuals, I think we should have a way to export static offline websites bundled up as a folder.

And, from your what I understand, Franklin doesn’t seem to currently support this feature.

Instead of always requiring a server, specially for these types of interactive manuals, I think we should have a way to export static offline websites bundled up as a folder.

If you consider super standard SSG like Hugo or Jemdoc, they also generate a folder similar to __site for Franklin for which you also need a local server to see the website locally fully rendered.

To have a HTML file fully rendered by a browser just when you double click on it, it needs to have the entirety of assets inside the file; this makes sense for a very narrow set of use case such as, for instance, notebooks (e.g. Weave). You can do exactly the same in a single-page Franklin site by injecting the assets directly in the layout.

There’s no plan to have some option that does this automatically for a generic website.

1 Like

Thank you for your response, I can imagine the challenges of doing so for a generic website.

I really like Franklin’s way of converting Markdown to HTML, so I think I can glue that engine into an HTML template to make static manual pages as I need.

1 Like