Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extras/shortcodes: Add Reuse Page Shortcode concept #3231

Closed

Conversation

savsheniuk
Copy link

Add a Reuse Page shortcode that allows tech writers to reuse same pages in different places without need in copy-pasting them every time.
It also adds a concept of Page snippets and dynamic links resolution.

@CLAassistant
Copy link

CLAassistant commented Mar 24, 2017

CLA assistant check
All committers have signed the CLA.

@moorereason
Copy link
Contributor

@savsheniuk,
The problem with the CLA is likely that your git commits use a different email address than your GH account.

@savsheniuk
Copy link
Author

savsheniuk commented Mar 24, 2017

@moorereason Oh, yes. You are right :( Thanks a lot 👍

@bep
Copy link
Member

bep commented Mar 28, 2017

Hey and welcome to Hugo devs, @savsheniuk !

I have read your code, and it looks solid. So, I understand that you are a good developer.

But I'm not sure how this fits into the "vision" #3205, and the quantity of changes tell me that I don't want to commit to this right now.

I would probably have preferred to make it simpler:

  • Just mark them as snippets in a front matter and put them in a temporary collection and just look in all page collections when referenced (in some order)
  • Instead of some new shortcode syntax, I would prefer just to create a Hugo internal shortcode (hugo-snippet or whatever, with a reserved namespace).

But even with those simplifications, I'm hesitant at the moment.

But what would have been a good idea, and I feel it would solve the same problem, would be some kind of caching internal decorator shortcode, so I would do something like this:

{{< hugo-cached >}}
{{< readAndMarkdownify filename="/some-file.md" >}}
{{< /hugo-cached >}}

Where hugo-cached would be a special internal shortcode that would somehow use all the parameters for the inner shortcodes as a cache key.

@savshen
Copy link

savshen commented Mar 28, 2017

Thanks, @bep . I understand your concern.
Just one note that markdownify function doesn't handle shortcodes in the specified page and in order to do that I needed to get to the context of the page rendering...
so the decision was to do that on the stage of the shortcodes processing what pointed me onto writing a new kind of shortcode that works as any other shortcode but allows to use the content of the page as an inner content...
it looked to me as a pretty generic solution... although I spontaneously added a few other features to that shortcode like Dynamic links processing and Page snippets....
so now it could seem a little overflown...

@savsheniuk savsheniuk force-pushed the reuse-shortcode-concept branch 2 times, most recently from 92cb5f0 to f4ea163 Compare March 30, 2017 10:07
Add a Reuse Page shortcode that allows tech writers to reuse same pages in different places without need in copy-pasting them every time.
It also adds a concept of Page snippets and dynamic links resolution.
@savshen
Copy link

savshen commented Mar 31, 2017

Fixed the first point: new parameter "issnippet=true" can be specified inside the front-matter to mark the page as a snippet.

@bep bep removed the Docs label Jun 26, 2017
@bep
Copy link
Member

bep commented Jun 26, 2017

I will close this as I think this is too big a change for what it is.

Most of this will be gained from #3612

@bep bep closed this Jun 26, 2017
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 11, 2022
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants