Sha256: 60bc1989cbf61a0379177c430c73af51dcaad23e201630131408780e7212ccd9

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

---
title: Webgen::Tag::Relocatable
used_options:
  - tag.relocatable.path
---
## Description

This tag ensures that the relative path to the specified path is always correct.

When the tag is used, it changes the directory part of the supplied path name to a relative path to
the destination and is most often used in template files. A relocatable tag looks like this:
`\{relocatable: default.css}`. If this was put into a template and the template was used by a file
in a subdirectory, then the `relocatable` tag would put `../default.css` into the output file; thus
ensuring that the relative path to file is valid.

> You can only use the `relocatable` tag with paths that are handled by webgen. If you want to
> handle paths that are not normally handled by webgen, create a virtual path for them.
{:.important}

If the specified path is an absolute URL (like `http://webgen.rubyforge.org`), it will just return
it. And if you specify an URL fragment, this fragment has to exist. If you don't want to resolve a
fragment, just don't specify it in the tag but afterwards!

## Examples

<table class="examples">
<tr>
  <th>Usage</th><th>Output</th>
</tr>
<tr>
  <td>\{relocatable: /default.css}</td>
  <td>{relocatable: /default.css}</td>
</tr>
<tr>
  <td>\{relocatable: ../}</td>
  <td>{relocatable: ../}</td>
</tr>
</table>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
webgen-0.5.17 doc/tag/relocatable.page
webgen-0.5.15 doc/tag/relocatable.page
webgen-0.5.14 doc/tag/relocatable.page
webgen-0.5.13 doc/tag/relocatable.page
webgen-0.5.12 doc/tag/relocatable.page
webgen-0.5.11 doc/tag/relocatable.page