#Name of file

1 messages · Page 1 of 1 (latest)

jolly tartanBOT
#

Hi @remote fox. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

In Astro, you can access the name of a file using the file property. This property provides the absolute path of the file.

For instance, when using an import statement or Astro.glob(), the file property is available to a .astro component. It returns the absolute file path (e.g. /home/user/projects/.../file.md).

Here is an example of how you can use it:

Astro.props = {  
  file: "/home/user/projects/.../file.md",  
  // other properties...
}

In this example, Astro.props.file would return the absolute path of the file.

You can find more information about this in the Astro documentation (https://docs.astro.build/en/guides/markdown-content/#exported-properties).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@remote fox kapa.ai is still learning and improving, please let us know how it did by reacting below