Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Find a page

Started by Muut Archive 11 years ago · 5 replies · 277 views
11 years ago

Hello, is there any setting I have to make in the front matter to make a page searchable.

I have a directory xyz under pages which has sub directories.. ABC and def. These sib directories ABC and def have its corresponding md files and slug a-b-c and d-e-f respectively.

I am trying to find the page ABC by doing page.find ('/xyx/a-b-c') and trying to access the front matter of that page. But, somehow I don't get that page.

Is there anything wrong that I am doing?

11 years ago

First can you reach them via your browser? That is a good way to ensure the route is correct.

Second, are these pages published ? If you for some reason set them to unpublished or if you set the date in the future, they will not be found.

Other than that seems like it should work as you have described.

11 years ago

Hello, thanks for the reply. I am indeed able to reach the route via the browser, and I did verify that.

I have not explicitly set the published attribute either. I am using the latest grav 0.9.45.

11 years ago

Side note: my first blog posts with Grav took hours to get published.
I was only able to fix it when the Admin plugin was made available and I noticed that the default Server Time was PST (I think) which explained the discrepancy with my posts' actual creation timestamp in my time zone.

11 years ago

@minu can you confirm what you get back from the fine with something like:

TWIG
{{ dump(page.find('/xyz/a-b-c')) }}

Turn on the Grav debugger and look in the first messages panel. You should be able to expand the variable if it exists, or if it doesn't find it, there will be a null printed.

11 years ago

Hi, I have fixed it now.
It was a page reference error that caused the problem. My bad!
@rhukster: Thanks for the pointer

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1341 9 years ago
Archive · by Muut Archive, 9 years ago
2 928 9 years ago
Archive · by Muut Archive, 9 years ago
2 4057 9 years ago
Archive · by Muut Archive, 9 years ago
1 2942 9 years ago
Archive · by Muut Archive, 9 years ago
3 1115 9 years ago