Page Bundle and bookmark shortcode

Posts have bookmarks - links to other posts. It worked before I switched to page budle. How to modify bookmark shortcode to make it work with this:
{{< bookmark url=“/postname_rel_url_aka_slug/” >}}

I tried with this, but no luck

{{- with .Site.GetPage "url" -}}
<figure class="fg-bookmark"><a href="{{ .RelPermalink }}"><div class="fg-bookmark-content"><div class="fg-bookmark-title">{{ .Params.title }}</div><div class="fg-bookmark-description">{{ .Summary }}</div><div class="fg-bookmark-website"><img src="/icons/favicon/favicon-16x16.png" class="fg-bookmark-icon"><span class="fg-bookmark-sitename">{{ site.Title }}</span></div></div>
    {{ with .Get "thumbnail" }}
    <div class="fg-bookmark-thumbnail"><img src="{{ .Params.image }}"></div>
    {{ end }}</a>
</figure>
{{ end }}

Tried this to make the shortcode work, but no luck.

{{< bookmark url="/postname/" >}}

the file

{{ $path := .Get "url" }}
{{$page := .Site.GetPage $path}}
<figure class="fg-bookmark"><a href="{{$page.RelPermalink}}"><div class="fg-bookmark-content"><div class="fg-bookmark-title">{{ $page.Title }}</div><div class="fg-bookmark-description">{{ $page.Summary }}</div><div class="fg-bookmark-website"><img src="/icons/favicon/favicon-16x16.png" class="fg-bookmark-icon"><span class="fg-bookmark-sitename">{{ site.Title }}</span></div></div>
    <div class="fg-bookmark-thumbnail">
        {{ $original := path.Base $page.Params.image }}
        {{ $originalImg := $page.Resources.GetMatch $original }}
        {{ if $originalImg }}
            {{ printf `<img src="%s" alt="%s">` 
                $originalImg.RelPermalink $page.Title | safeHTML }}
        {{end}}
    </div></a>
</figure>

The .GetPage methods on .Page and .Site look for a page based on the content path, not the URL.

{{ site.GetPage "/postname/" }} looks for a section named postname in the root of the content directory.

{{ site.GetPage "/postname" }} looks for a page (either regular or a page bundle) named postname in the root of the content directory. The file extension is optional.

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