# Template not applied to site generated by Franklin.jl

**URL:** https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279
**Category:** General Usage
**Created:** [September 14, 2022, 3:25pm UTC](https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279 "2022-09-14T15:25:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)
#### Post date: [September 14, 2022, 3:25pm UTC](https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279/1 "2022-09-14T15:25:24Z")

</div>

I am trying to host a static site created by `Franklin.jl` using GitHub Pages of my job’s GitHub Enterprise Server. The hosting part seems working fine because I can access the website through my job’s private network.

However, the template is not applied to the website. The website shows `index.html` as

 ![Screen Shot 2022-09-14 at 11.12.16](https://global.discourse-cdn.com/julialang/original/3X/1/d/1d4b6513ca4654c77c1235dde2a80c754a799256.png)

whereas the localhost shows the same file as

 ![Screen Shot 2022-09-14 at 11.14.20](https://global.discourse-cdn.com/julialang/original/3X/8/7/879d214100a97f9614f92a4211508f686156568d.png)

I don’t know much about web programing, so I’m not sure if this is a CSS issue or JavaScript issue or something else. Any suggestions on trouble-shooting this issue?

A few things that might be relevant:

- My job’s GitHub Enterprise Server is not offering GitHub Actions, so the publishing process cannot be automatized.
- I created a repository named `pages` in my job’s GitHub, and pushed the contents of the `__site` directory locally created by `Franklin.serve()`.
- Then in GitHub \> `pages` repository \> Settings \> Code and automation \> Pages, I indicated the `main` branch as the source of the GitHub pages. Then the link to the website was displayed. Going to the link showed the first screenshot above where the template was not applied.

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [September 14, 2022, 4:25pm UTC](https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279/2 "2022-09-14T16:25:09Z")

</div>

To me that looks like the css file is not found on sever  
Can you check with inspection tools (of your browser) which URL the html page is looking for the css file and where it actually is? Also for deployment the css file is usually copied by Franklin if I remember correctly so this copying should happen on the deployed folder as well.

---

<div class="post-metadata">

### Author: ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)
#### Post date: [September 14, 2022, 8:28pm UTC](https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279/4 "2022-09-14T20:28:55Z")

</div>

The first part of `index.html` reads

```julia
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="/libs/katex/katex.min.css">
   
   <link rel="stylesheet" href="/libs/highlight/styles/github.min.css">

The name of the GitHub repository for the GitHub Pages is `pages`
   

  <link href="/css/franklin.css" rel="stylesheet">
<link href="/css/vela.css" rel="stylesheet">

```

I think the location of the CSS file indicated in the last line, `href="/css/vela.css"`, is correct, if it is a relative path w.r.t. the directory of `index.html`. Specifically, the name of the GitHub repository for the GitHub Pages is `pages` as mentioned in OP. The link to the website displayed in “GitHub \> `pages` repository \> Settings \> Code and automation \> Pages” is

```julia
https://pages.<my job's GitHub domain>/<my ID>/pages/

```

so I think the above `href` value points to

```julia
https://pages.<my job's GitHub domain>/<my ID>/pages/css/vela.css

```

If I access this location in the web browser, I see

```julia
/*
small alterations for Franklin
*/
h1.page.title,
hr {
  position relative
  padding-left: 12.5%;
  padding-right: 12.5%;
  line-height: 1.35em;
}

@media (min-width: 940px) {
  h1.page.title,
  hr {
    width: 705px;
    margin-left: auto;
    margin-right: auto;
  }
}
...

```

which seems the correct CSS for the `"vela"` template…

---

<div class="post-metadata">

### Author: ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)
#### Post date: [September 15, 2022, 8:35am UTC](https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279/5 "2022-09-15T08:35:09Z")

</div>

I think with the `/` upfront the css might actually point to the base directory, that is, the browser looks at

`pages.<GitHubDomain>/css/vela.css` so maybe remove the first `/` in the `<link>`tag? See also [Starting with a forward slash in html for "href" - Stack Overflow](https://stackoverflow.com/questions/10659459/starting-with-a-forward-slash-in-html-for-href)

---

<div class="post-metadata">

### Author: ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)
#### Post date: [September 15, 2022, 10:02am UTC](https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279/6 "2022-09-15T10:02:51Z")

</div>

In your `config.md`, what did you set the `prepath` to? (or did you set it).

Here are some cases of where you expect your landing page to be and what the prepath should be:

- `https://www.foo.bar/` → `prepath = ""` (or unset)
- `https://www.foo.bar/baz/` → `prepath = "baz"`
- `https://www.foo.bar/baz/biz/` → `prepath = "baz/biz"`
- `https://username.github.io/` → `prepath = ""` (or unset)
- `https://username.github.io/Project/` → `prepath = "Project"`

from what you describe (local ok, remote not ok) I’m fairly sure that’s your issue. I suspect you should set it to

```julia
# https://pages.<my job's GitHub domain>/<my ID>/pages/
prepath = "<my ID>/pages"

```

**Edit** : you may actually have set the `prepath` properly but didn’t **apply** it (given you’re pushing things manually). To push things manually, either:

1. call `optimize(...)` (e.g. `optimize(minify=false, prerender=false)` to keep things simple)
2. push the content of `__site/`

or call `publish(...)` (which is a wrapper for 1+2).

If you push the content of `__site` directly after a local `serve(...)`, the prepath will be un-set, even if you specified it.

`optimize` will “apply” the prepath that you specified. (You can see this in `__site` afterwards where paths will be like `href="/$prepath/css/main.css"` .

See also: [Deploying your website](https://franklinjl.org/workflow/deploy/#deploying_on_an_existing_web_server)

---

<div class="post-metadata">

### Author: ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)
#### Post date: [September 15, 2022, 1:27pm UTC](https://discourse.julialang.org/t/template-not-applied-to-site-generated-by-franklin-jl/87279/7 "2022-09-15T13:27:58Z")

</div>

Thank @tlienart for the insightful answer! The issue is resolved now.

Both of your suggestions were crucial. Specifically,

- I included `prepath = "<my ID>/pages"` in `config.md`.
  - Previously I had tried `prepath = "pages"` thinking that `prepath` would need to be the repository name, but it seems that it needs to be the entire part that comes after the first `/` in the URL.

- I performed `optimize()` before pushing the website contents to GitHub.

Implementing only one of the above two steps didn’t solve the issue.
