# Why i am not getting the absURL in head schema?

**URL:** <https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478>\
**Category:** support\
**Created:** [May 5, 2022, 5:23pm UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478 "2022-05-05T17:23:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [May 5, 2022, 5:23pm UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478/1 "2022-05-05T17:23:53Z")

</div>

Hi there,

## Added schema today to a website but cannot figure out what i am doing wrong. is this setup correct for expected value:

```plaintext
# Domain: example.com
# Post: Blog post 1
# Cover image: image1.png

├── content
│ └──── blog
│ └──── blog-post-1
│ ├── images
│ | ├── image1.png
│ | ├── image2.png
│ └──── index.md
|
├── layouts
│ └──── partials
│ └──── head.html

```

### baseurl

`baseURL: https://example.com/`

### frontmatter of blog-post-1

`ogimage: image/image1.png`

### use of front matter value in partial head

`"image": "{{ .Params.ogimage | absURL }}",`

### expected url

`example.com/blog/images/image1.png`

### returned url:

`example.com/image1.png`

what i am doing wrong here?

thanks for taking the time to help

---

<div class="post-metadata">

**Author:** ![brilliantzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/brilliantzen/32/16795_2.png) [@brilliantzen](https://discourse.gohugo.io/u/brilliantzen)\
**Post date:** [May 5, 2022, 10:55pm UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478/2 "2022-05-05T22:55:57Z")

</div>

> [@pitifi9191](#):
>
> absURL

Both `absURL` and `relURL` consider the configured value of `baseURL` in your site’s [`config` file](https://gohugo.io/getting-started/configuration/). Given a `baseURL` set to `https://example.com/hugo/` :

{{ “mystyle.css” | absURL }} → “[https://example.com/hugo/mystyle.css](https://example.com/hugo/mystyle.css)”  
{{ “mystyle.css” | relURL }} → “/hugo/mystyle.css”

Suffice to say, your absURL is what you set as a base in your config.toml

---

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [May 6, 2022, 10:19am UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478/3 "2022-05-06T10:19:19Z")

</div>

hi @brilliantzen

since i am getting the valude from frontmatter i am expecting it to add the apropriate path after the base url. it supose to work like this i remember doing this way in past not sure what i am currently doing wrong. do you see everything good with this example?

> [@pitifi9191](#):
>
> ### expected url: [example.com/blog/images/image1.png](http://example.com/blog/images/image1.png)
> 
> ### returned url: [example.com/image1.png](http://example.com/image1.png)

---

<div class="post-metadata">

**Author:** ![GhsvsDe](https://avatars.discourse-cdn.com/v4/letter/g/9fc29f/32.png) [@GhsvsDe](https://discourse.gohugo.io/u/GhsvsDe)\
**Post date:** [May 6, 2022, 1:13pm UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478/4 "2022-05-06T13:13:05Z")

</div>

With other words (already said above): `absURL` is a function that prepends the configured `baseURL` to the provided path as it is. It has no deeper “magic” that calculates any paths from your content structure in the background. Therefore your “returned url” is the “expected url”.

As far as I understand you use a Leaf Bundle. Therefore I would try something with resources,Get but ?.

I would be willing to test this if you would provide a repo or other running test environment.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [May 6, 2022, 4:48pm UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478/5 "2022-05-06T16:48:22Z")

</div>

structure

```auto
content
├── blog/
│ └── blog-post-1/
│ ├── images/
│ │ ├── image1.png
│ │ └── image2.png
│ └── index.md
└── _index.md

```

content/blog/blog-post-1/index.md

```nohighlight
+++
title = 'Blog Post 1'
date = 2022-05-06T09:33:00-07:00
draft = false
ogimage = 'images/image1.png' # You neglected to include the subdirectory
+++

```

template

```auto
{{ with .Resources.Get .Params.ogimage }}
  "image": "{{ .Permalink }}"
{{ end }}

```

result

```auto
"image": "https://example.org/blog/blog-post-1/images/image1.png"

```

---

<div class="post-metadata">

**Author:** ![pitifi9191](https://avatars.discourse-cdn.com/v4/letter/p/3ab097/32.png) [@pitifi9191](https://discourse.gohugo.io/u/pitifi9191)\
**Post date:** [May 7, 2022, 9:15am UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478/6 "2022-05-07T09:15:10Z")

</div>

Thanks @jmooring

> [@jmooring](#):
>
> `{{ with .Resources.Get .Params.ogimage }}`

The above solution did the job. My confusion arises when a method works for a site.params doesn’t work for the page.params

```auto
# This works
<meta property="og:image" content="{{ .Site.Params.ogimage | absURL }}" />

# Doesn't works
<meta property="og:image" content="{{ .Page.Params.ogimage | absURL }}" />

# Doesn't works
<meta property="og:image" content="{{ .Params.ogimage | absURL }}" />

# Doesn't works
{{ with .Params.ogimage }} 
  <meta property="og:image" content="{{ . | absURL }}" />
{{ end }}

```

Thank you for taking the time to assist me in my efforts to solve this mystery.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [May 9, 2022, 9:15am UTC](https://discourse.gohugo.io/t/why-i-am-not-getting-the-absurl-in-head-schema/38478/7 "2022-05-09T09:15:27Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
