Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML, CSS, haml - problems with relative links on a layout for a padrino/sinatra/rails style static website generator
    primarykey
    data
    text
    <p>I am using a static site generator to make a site that sits on a shared network folder at my job. It's a simple tutorial site for my co-workers—it's not hosted, there's no server, and it's completely static. I am using <a href="http://middlemanapp.com/" rel="nofollow">the Middleman</a>, which is a great app. I just need it to publish a website I can use from a folder like this.</p> <p>The problem is that my <code>index.html</code> and other HTML files are in different folders. The web structure is like this:</p> <pre><code>-index.html +guides/ -guide1.html -guide2.html +stylesheets/ +images/ </code></pre> <p>...you get the idea. My navigation is all in my <code>layout.haml</code>, however, every time I navigate outside of my root <code>index.html</code>, the <code>nab</code> links get all messed up. If I use (../) or (./) they look to folders that don't even exist. Here is a piece of my current <code>layout.haml</code> nav (you can see I tried a couple of things):</p> <pre><code>%nav %ul %li.div= link_to 'Home', "index.html" %li %a{:href =&gt; ("/guides/getting-started.html")} Getting Started %li= link_to 'Tool Tip 1', "guides/tooltip1.html" %li= link_to 'Tool Tip 2', "guides/tooltip2.html" %li= link_to 'Tool Tip 3', "guides/tooltip3.html" </code></pre> <p>It was suggested that I put a 'helpers do' in my config.rb. It should look something like this:</p> <pre><code>helpers do def relative_link_to(text, url) # Get current path # Get path of url # Get relative relation between paths # Pass new data to the original link_to helper link_to(text, relative_url) end end </code></pre> <p>That's the point where I got lost, the 'helpers do' part. Can someone point me in the right direction or just help me out?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload