Skip to content

Commit

Permalink
Add doc to warn about strange behaviour with assets path when using d…
Browse files Browse the repository at this point in the history
…irectory indexes.

Fixes middleman/middleman#818
  • Loading branch information
michaelbaudino committed Sep 23, 2013
1 parent 8c4ee6f commit bcd85fe
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source/pretty-urls.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ Or, you may want a PHP file:
set :index_file, "index.php"
```

#### Warning about assets path

When using directory indexes, calling assets (e.g. image files) by their filename only will fail. They need to be called with their full absolute path, like this:

``` ruby
![Amazing picture](/posts/2013-09-23-some-interesting-post/amazing-image.png)
```

To slightly automate this process, the markdown may be processed by ERB first. For exemple, in a file named `/posts/2013-09-23-some-interesting-post.html.markdown.erb`:

``` ruby
![Amazing picture](<%= current_page.url %>some-image.png)
```
## Opt-out
If there are pages which you don't want automatically renamed, you can opt-out:
Expand Down

0 comments on commit bcd85fe

Please sign in to comment.