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

Pop-up Markdown

Started by Muut Archive 10 years ago · 13 replies · 1028 views
10 years ago

Hello !

I created a changelog (displayed: "version x.y") in the footer of the skeleton/theme Ceevee. The "x.y" is an anchor link. When I click on it, it opens a pop-up with Magnific-popup.js.
The data is stored in partials/changelog.html.twig which is loaded in footer.html.twig.

What i'd like is to dynamically manage its content with Markdown in a file called changelog.md. The issue is that when i create this file in 01.home, i have an error saying that the template hasn't been found.

What did I do wrong?

10 years ago

helmasaur,

I don't think you can have two markdown files in the same folder. You might try using a yaml or json file. There are plugins for interacting with json and text files as well. You could also make the changelog a child of home and hide the folder so it does not display in the menus.

10 years ago

First of all, thanks for your answer.

To be honest with you, I don't know how a page is generated from a Markdown and Twig file. What I'd like is to just edit a file in the "page" folder and do not touch anymore my changelog template.

I saw that all the other stuff is registered in a Markdown file with some YAML in its header.
As I need only the variables, I guess that the solution is creating a changelog.yaml as you said?

But then, in my Twig template, how can i get the informations I want?

10 years ago

I would first read over the "Basic Tutorial" docs to get an idea of how the markdown/twig relationship combine to output HTML:

10 years ago

I based what i did on this part of the tutorial. English isn't my first language so I might have done something wrong. I will read the page again :) .

10 years ago

I got an information i really neded in the page you linked me. Although, it's written that YAML is only for configuration.

I'm sorry to sound so lost but I really don't know where to put the data from each version.

10 years ago

helmasaur, No need to apologize. I am still new to the Grav community as well and still trying to figure things out. It takes time. One thing with Grav is that there seems to be so many ways to get things done, it is just a matter of finding the way you want to accomplish your task and doing it.

Are you creating multiple changelog files or one file that will be updated? What content will the file hold and will that content be shown on the home page or another page? Can the page be created in Grav CMS itself or does it need to stay separate?

Even though yaml are used for configuration, I don't see why they can't be used to store any structured data. Look at the Grav learn page about yaml and the resource pages listed at the bottom and see if yaml will work for storing your changelog content. https://learn.getgrav.org/advanced/yaml

10 years ago

Once again, thanks for your answer!

I made up quickly an example of what I'd like to do: (intendation doesn't work)
title: Changelog
changelog:

  • version: 2.1
  • description:
    • line: Bug fix
    • line: Language support
  • version 2.0
  • description:
    line: Adding community support
  • version 1.0
  • description:
    • line: Official release

I want to access to those data in a template called changelog.html.twig which is loaded in a jQuery popup when the user clicks on the changelog link which is located in the footer.

10 years ago

indention does work if you use markdown-style triple backticks or triple dashes above and below your code. Click the ? icon in the input box for more help.

10 years ago

Oh thanks ! I didn't realize it was a Markdown forum. So that's an example on how i'd like to store my data in changelog.md to then load in changelog.html.twig.

Any idea on how to do it?

YAML

title: Changelog
changelog:
   version: 2.1
   description:
     line: Bug fix
     line: Language support
   version 2.0
   description:
     line: Adding community support
   version 1.0
   description:
     line: Official release
---
10 years ago

if your already loading a changelog.md page, why not just put your changelog in as markdown content? You could just use some CSS to style it on output. I'm not sure I see the point of storing this in header yaml, and then looping over and parsing it at runtime. A changelog is just a title/version/list of items. That is easily enough to do with just Markdown:

MARKDOWN
# 1.2.1

* Bug fix
* Language Support

# 2.0

* Adding community support

# 1.0 

* Official release
10 years ago

That's a very good point! Although, I have the same issue, I don't know how to include a markdown file in an other one without creating a page. I don't want http://mysite/changelog to exist and I don't want it to be displayed in my one page home

10 years ago

I give myself the permission to doubld post.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1362 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2959 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago