---
title: 'Use page resources within inline html on a page'
url: 'https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234'
markdown: 'https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234.md'
date: '2026-06-21'
description: 'So, I’ve got a need for a specific object, that is represented in markdown as html like so <object width="400" height="500" type="application/pdf"'
---

[Support](https://getgrav.org/forum/support)

#  Use page resources within inline html on a page 

  Started by rappluk 1 year ago · 10 replies · 737 views    

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40919 "Permalink") 

So, I’ve got a need for a specific object, that is represented in markdown as html like so

```markdown
<object width="400" height="500" type="application/pdf" data="page://manual.pdf">

    <p>Ups, das PDF der Anleitung kann nicht angezeigt werden...</p>

<a href="page://manual.pdf">Hier herunterladen</a>

</object>
```

However, quite obviously the href and data attribute doesn’t resolve the `page://manual.pdf` link.

What is my best course of action here? Switch to modular and just use a “object module” here? Any other way to link to / display my pdf properly within that page?

Thanks a lot 🙂

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40920 "Permalink") 

IIRC, you can access any uploaded file via `page.media` 🤔

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40921 "Permalink") 

But isn’t that in twig then? How would I do the same in markdown?

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40922 "Permalink") 

Sorry, misunderstood the question

So to render just a link, it's quite simple:

```md
[Link text](file_on_page_pdf)
```

But if you want to render an actual preview of the PDF, I assume you will need some plugin. Don't know if any exist for this kind of output

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40923 "Permalink") 

I know how the markdown link is supposed to work.
I guess maybe what confuses us is the following: Can twig variables be used in the html-within-markdown snippet above?
so in essence, could I have `data="page.media.whatever(‘manual.pdf’)">` in that html snippet?

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40924 "Permalink") 

In the page frontmatter add:

```yaml
---
process:
    twig: true
---
```

In admin it's on the *Advanced* tab

I have used Twig in MD like this and tested just now with `{{ page.title }}` and it works. I don't remember the structure of `page.media`, so I didn't test that

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40927 "Permalink") 

> **@rappluk:**
> `<object width="400" height="500" type="application/pdf" data="page://manual.pdf">`

isnt this just html? i dont see where it triggers to render something as twig.

i would use something like {{ }} when i want to use twig, and as Karmalakas said i would active twig for that page.

another way

why would i use twig for that? the url of that file would be something like ((url of that page) + (file name)) ex: mypage.com/apage/manual.pdf so i would just put this url there.

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40928 "Permalink") 

Well I want to avoid hardcoding that URL, since the page name, slug, you name it could change later, or between localisations.

Whatever that is called, twig, markdown link, I want whatever `page://manual.pdf` represents to be rendered by grav, so even if anything changes about my structure, it will still return the location of the pdf in the current page.

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40930 "Permalink") 

So did you try with twig processing enabled?

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40931 "Permalink") 

@rappluk, First of all, to me, your requirements could be stated a tad more specific. Currently, a lot of questions arise...

Anyway...

Have you had a chance to read the docs on [Media](https://learn.getgrav.org/17/content/media)?

It provides several examples showing how to get the url of a media file inside the folder of a page, or anywhere else, using Twig (which can be used inside Markdown).

You also might have a look at Grav's API which shows the interfaces the [Media](https://learn.getgrav.org/17/api) object implements.

Some examples to get a media file from within the current page's folder:

```twig
# Get any media file
<a href="{{ page.media['manual.pdf'].url | e }}">Named media file</a>
<a href="{{ (page.media|first).url | e }}">First media file</a>

# get image files
<a href="{{ page.media.images['myimage.png'].url | e }}">Named image file</a>
<a href="{{ (page.media.images|first).url | e }}">First image file</a>

# Get data/document files like pdf
<a href="{{ page.media.files['manual.pdf'].url | e }}">Named file</a>
<a href="{{ (page.media.files|first).url | e }}">First file</a>
```

 👍 1 

last edited 10/24/25 by pamtbaau

 [1 year ago](https://getgrav.org/forum/support/use-page-resources-within-inline-html-on-a-page-t3234#post-40962 "Permalink") 

@rappluk, Any progress you would like to share? It would benefit the community.

[Log in](https://getgrav.org/login?return=%2Fforum%2Fsupport%2Fuse-page-resources-within-inline-html-on-a-page-t3234) to reply.

###  Suggested topics

 | Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| [Try to inherit a Theme but get an error](https://getgrav.org/forum/support/try-to-inherit-a-theme-but-get-an-error-t9508)    [Support](https://getgrav.org/forum/support) · by TomW, 1 day ago |  | 2 | 34 | [2 hours ago](https://getgrav.org/forum/support/try-to-inherit-a-theme-but-get-an-error-t9508 "by TomW") |
| [retina images are shown in Admin (but not all of them)](https://getgrav.org/forum/support/retina-images-are-shown-in-admin-but-not-all-of-them-t9504)    [Support](https://getgrav.org/forum/support) · by Anna, 1 week ago |  | 2 | 143 | [1 day ago](https://getgrav.org/forum/support/retina-images-are-shown-in-admin-but-not-all-of-them-t9504 "by Anna") |
| [page.date != page.header.date, now my collection sorting is broken (bug? by design?)](https://getgrav.org/forum/support/page-date-page-header-date-now-my-collection-sorting-is-broken-bug-by-design-t9484)    [Support](https://getgrav.org/forum/support) · by Anna, 3 weeks ago |  | 1 | 299 | [3 weeks ago](https://getgrav.org/forum/support/page-date-page-header-date-now-my-collection-sorting-is-broken-bug-by-design-t9484 "by Anna") |
| [it's no possible sign in with email......](https://getgrav.org/forum/support/it-s-no-possible-sign-in-with-email-t9462)    [Support](https://getgrav.org/forum/support) · by webmasterodp, 1 month ago |  | 4 | 400 | [1 month ago](https://getgrav.org/forum/support/it-s-no-possible-sign-in-with-email-t9462 "by webmasterodp") |
| [Site stopped working overnight - 'not writeable' error](https://getgrav.org/forum/support/site-stopped-working-overnight-not-writeable-error-t9445)    [Support](https://getgrav.org/forum/support) · by nwhitfield, 1 month ago |  | 2 | 373 | [1 month ago](https://getgrav.org/forum/support/site-stopped-working-overnight-not-writeable-error-t9445 "by pamtbaau") |
