Deploying a website with Franklin

I am deploying a website with Franklin.jl on my own web server instead of using GitHub.

When I use serve() with Franklin and view the website on localhost, it appears correctly.

However, when I deploy the __site folder and view it on the internet, it is not displayed properly:

https://crucialflow.com/site/__site/

What additional steps do I need to take for deploying the website?

Have no clue how any of this works. But your assets are pointing to:

When they should be pointing to:

Again, no clue how Franklin works. Just telling you where the assets are

1 Like

@tlienart

1 Like

If the site is meant to just be a “sub” site then you need to use the prepath option I believe. See https://franklinjl.org/workflow/#publish

2 Likes

Alright, now it displays correctly after I changed prepath to site/__site, which is a partial solution.

Now, I am wondering how can I deploy the git repository in such a way that the page is in site instead of the subdirectory of site/__site? At this point, this is more of a git question than Julia.

This is my .git/hooks/post-receive script

GIT_WORK_TREE=../../public_html/site git checkout -f

I’m a bit baffled and confused about how I’m supposed to deploy the git repository with only __site?

Hello, apologies for the inconvenience.

So if you would like your home page to be deployed at crucialflow.com/site/ then you need to set the prepath to site, I think you figured that one out.

If you’re using your own server, your server needs to only see the content of __site. This is what happens on github for instance where the content of __site is built then copied on a branch and the branch is the one that’s used for displaying the site.

I’m not sure what your setup is (for instance if you use Netlify then it’s easier) maybe one thing you could do is reproduce the setup from github so:

  • do stuff locally
  • when happy push the content of __site (only) to a website branch
  • have your webserver based on that website branch

for the part to push only the content of a folder to a branch, I think this page explains how to do it in Git.

I hope this helps a bit

PS: GitLab is pretty good as well to help with this kind of gymnastics while keeping your repo private. I think you could have the same steps as suggested above but done on GitLab automatically whenever you push. (Though it would require setting up a key pair I would imagine so that you can copy stuff to your webserver)

If you manage to get something to work, kindly open an issue on franklindocs explaining what you did & I’ll add it to the docs, it might help others with similar setup :slight_smile:

6 Likes

Thanks for your help, I now have my new homepage (not /site) generated with Franklin.jl

Julia discourse didn’t allow me to respond with the URL and blocked my message, so you’ll have to type the url crucial flow .com without the /site. Source is at https://github.com/CrucialFlow/Research

Only issue now is that all the images (specifically repo badges) are resized and too big now.

How can I get the badges to be a normal size?

Oh wow that’s not good (but also a bit funny).

So the templates ship with some (very) barebone CSS which lives in _css/franklin.css, in there if you look at these lines: https://github.com/CrucialFlow/Research/blob/0342704396812c4345230d365595b8e5a7382d43/_css/franklin.css#L182-L192 there are fairly catch-all rules for images. So if you just use the basic ![alt](path/to/img) it will fall in the first generic rule which makes the image 70% of the visible width (which looks horrendous in your case).

So to avoid this you can just remove those lines, maybe add your own that look like the .img-small one so that you could have specific styles for given images.

Finally you might want to have a look at this issue where there is more discussion on how you can generally specify image dimensions building your own commands which can be useful.

PS: one other small thing, the templates ship with an initial favicon.png that is located in _assets/ , it’s an image of an iguana. I initially thought that was quite funny but now I realise that people may forget its there and end up with that iguana for a fair while. I really need to remove it from default templates. Anyway you can either:

  • change that favicon.png for another one that would make sense for you
  • remove the favicon line in _layout/head.html
  • (leave the iguana)
2 Likes

How can I display \LaTeX from a package, such as \mapsfrom in stmaryrd package?

The favicon is fine right now, I’m gonna worry about that at a later time.

One thing I’m interested in is to transform a database of \LaTeX notes into a website. My package VerTeX.jl can maintain a database of \LaTeX, and it would be interesting if I could combine that database with website generation from Franklin. However, there would need to be some way of handling things like \begin{definition} for example (I can manually make a \newcommand for that, but it wouldn’t be so convenient yet for automatically transforming a \LaTeX document.

So, Franklin is really fantastic, but I’m seeing a few issues with making a database of notes that can be simultaneously compiled into a complete \LaTeX document as well as a Franklin website. For now, I’m going to have to manually maintain these two separately, but I’m thinking about it.

Another issue is that \mathbb R displays correctly in Franklin but if I use

\newcommand{\mb}[1]{\mathbb{#1}}

to define a shortcut, \mb R doesn’t work, forcing me to switch to \mb{R} with braces.

Is there a possibility that the non-brace version could work for a \newcommand definition?

Right so Franklin does not aim to support full LaTeX parsing, rather just get inspiration from these handy new commands stuff.

However there is one thing you can do which might be quite close: using pandoc to go from latex to markdown and then plugging the result in Franklin. And you can do all that from Franklin by using small julia programs which call pandoc when relevant. If this could be something you’re interested in, I would suggest opening an issue on GitHub, I’ve been thinking about offering this capacity and have a good idea of how to do it but it should be tested and discussed.

Ps: I think there’s even a _jll file for calling pandoc

1 Like