--- 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
Usage | Output |
---|---|
\{relocatable: /default.css} | {relocatable: /default.css} |
\{relocatable: ../} | {relocatable: ../} |