Genie Discord forum

Author Avatarnikolaich
11/24/2023, 11:45:18 PM

I have a html page named product.jl.html. there i append various resources.

    <link rel="stylesheet" href="fonts/fonts.css" />
    <link rel="stylesheet" href="styles/global.css" />
    <link rel="icon" href="svg/favicon.ico" sizes="any" />
    <link rel="icon" href="svg/favicon.svg" type="image/svg+xml" />
    <link rel="stylesheet" href="styles/variables.css" />
    <link rel="stylesheet" href="styles/header.css" />
    <link rel="stylesheet" href="styles/product__style.css" />

And i have a route for this page:

route("/products/:id") do 
  product_id = parse(Int64,string(payload(:id)))
  product_result = Products.get_product(product_id)
  @info product_result
  page = open(io->read(io, String),"./public/product.jl.html")

For some reason Genie tries to add /products/ to every resource loading instance. For example: When i'm loading <link rel="stylesheet" href="fonts/fonts.css" /> genie tries to load ┌ Error: 2023-11-25 02:39:34 GET /products/fonts/fonts.css 404 . Genie clearly adds my route to my css path. Can i disable that somehow?

Author AvatarPere
11/25/2023, 8:35:43 AM

This happens because by not starting with / you're using relative paths. Try having /styles/header instead of styles/header

Author Avatarnikolaich
11/25/2023, 5:51:07 PM

Thank you very much ! I noticed that you answer quite a lot of questions there, i want to thank you for that also, i'm pretty sure i am using Genie for every one of my new projects.