mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-03 20:22:38 +00:00
29 lines
1001 B
Markdown
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 |