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

Reuse Text

Started by Muut Archive 9 years ago · 1 replies · 404 views
9 years ago

Hi, I'm a technical writer and looking for a simple solution for some software documentation projects. For my purpose markdown syntax and structure of the Grav server suits very well, because software developers are used to, and I want to participate them. I also like MarkDown very much.
What I'm missing is the ability to reuse text snippets. That's very important for technical documentation, because authors need to reuse the same text very often. A snippet could be a sentence, a paragraph, part of a list... It would be perfect, If I could use place holders, which could be changed in the target document.
The concept of modular pages are heading towards that, but are a bit to complex for fast writing. Do you have any suggestions for my use case?
Thx, Sisyphos

9 years ago

A possible way is to store your strings in a user/config/strings.yaml file

YAML
STRING_1: "A string"
STRING_2: "Another string"

and then use {{config.strings.STRING_1|t}} inside your pages.

With Twig processing enabled on the pages (a setting in the System config)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1338 9 years ago
Archive · by Muut Archive, 9 years ago
2 927 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2941 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago