--- title: PageRef description: Returns the `pageRef` property of the given menu entry. categories: [] keywords: [] params: functions_and_methods: returnType: string signatures: [MENUENTRY.PageRef] --- The use case for this method is rare. In almost also scenarios you should use the [`URL`] method instead. ## Explanation If you specify a `pageRef` property when [defining a menu entry] in your site configuration, Hugo looks for a matching page when rendering the entry. If a matching page is found: - The [`URL`] method returns the page's relative permalink - The [`Page`] method returns the corresponding `Page` object - The [`HasMenuCurrent`] and [`IsMenuCurrent`] methods on a `Page` object return the expected values If a matching page is not found: - The [`URL`] method returns the entry's `url` property if set, else an empty string - The [`Page`] method returns nil - The [`HasMenuCurrent`] and [`IsMenuCurrent`] methods on a `Page` object return `false` > [!note] > In almost also scenarios you should use the [`URL`] method instead. ## Example This example is contrived. > [!note] > In almost also scenarios you should use the [`URL`] method instead. Consider this content structure: ```text content/ ├── products.md └── _index.md ``` And this menu definition: {{< code-toggle file=hugo >}} [[menus.main]] name = 'Products' pageRef = '/products' weight = 10 [[menus.main]] name = 'Services' pageRef = '/services' weight = 20 {{< /code-toggle >}} With this template code: ```go-html-template {file="layouts/_partials/menu.html"}