<!-- Do not edit this file. It is automatically generated by API Documenter. --> [`MetadataCache`](MetadataCache) › [`fileToLinktext`](MetadataCache/fileToLinktext) ## MetadataCache.fileToLinktext() method Generates a linktext for a file. If file name is unique, use the filename. If not unique, use full path. **Signature:** ```typescript fileToLinktext(file: TFile, sourcePath: string, omitMdExtension?: boolean): string; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | <code>file</code> | [`TFile`](TFile) | | | <code>sourcePath</code> | <code>string</code> | | | <code>omitMdExtension</code> | <code>boolean</code> | _(Optional)_ | **Returns:** `string`