Files
hugo/content/functions/relLangURL.md
T
2017-02-26 19:27:05 -06:00

29 lines
1001 B
Markdown

---
title: rellangurl
linktitle: relLangURL
description: Similar to relURL, but adds the relative URL with correct language prefix according to site configuration for multilingual.
godocref:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
tags: [multilingual,i18n,urls]
categories: [functions]
signature:
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: [/functions/absurl/,/functions/rellangurl/]
needsexamples: true
---
`absLangURL` and `relLangURL` functions are similar to their `absURL` and `relURL` relatives but will add the correct language prefix when the site is configured with more than one language. (See [Configuring Multilingual][multiliconfig])
So for a site `baseURL` set to `http://yoursite.com/hugo/` and the current language is `en`:
```golang
{{ "blog/" | absLangURL }} "http://yoursite.com/hugo/en/blog/"
{{ "blog/" | relLangURL }} "/hugo/en/blog/"
```
[multiliconfig]: /content-management/multilingual/#configuring-multilingual-mode