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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Ajax to access the frontmatters?

Started by Muut Archive 9 years ago · 0 replies · 347 views
9 years ago

Hello,

First, I need to confess that I'm new with Javascript.
That being said, here is what I want to achieve :

A page "Tourism". On that page, two things :

  • A google maps with multiple markers
  • A list of those markers, with one picture, a heading and a subheading for each.
    When I'll click on one item in the list, or on one of the marker, it will link to a page, with a full description of the marker. (image, heading, subheading, text)

I thought to do it like that :

Tourism/
  marker-01/
    marker.md
  marker-02/
    marker.md
  marker-03/
    marker.md
  tourism.md

On the page tourism, I'll list my markers with :

content:
    items: @self.children

In every marker.md, I'll have a frontmatter with :

heading
subheading
img
location

So the question, is it possible to access to those frontmatters with ajax, to get the data I need to generate the google maps ?

I would need, first, to loop in each sub folder of the page tourism, read the marker.md and get the variables "heading", "subheading", etc....

Is it a good way to achieve that ?
Or should I think of an ohter way ?

I'm not asking for a ready made solution, I just want to know if it's possible and if you think that it's a good way of doing it. I'm eager to learn, but if I can learn something new for me and have a result... it's even better.

Thanks in advance for all your advise !

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1282 9 years ago
Archive · by Muut Archive, 9 years ago
2 889 9 years ago
Archive · by Muut Archive, 9 years ago
2 4019 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1078 9 years ago