De-duplication across language-specific documentation #3859
Replies: 5 comments 1 reply
-
Good topic. I feel we might be hitting a limitation of Hugo (and Markdown) here. Asciidoc and reStructuredText, for example, both support includes and content reuse, something that's available to Markdown only through templating mechanisms that weren't exactly designed for that. It's worth noting that Hugo supports both rST and Asciidoc (see additional formats), though I guess a full content migration is out of question... Would there be a way of having the reusable snippets (includes) live alongside the docs and be consumed from there, instead of having them inside a layout folder? |
Beta Was this translation helpful? Give feedback.
-
Since we use docsy, yet another option is
probably? I guess if there is a folder somewhere with files without frontmatter, I would guess they are ignored by hugo for page generation |
Beta Was this translation helpful? Give feedback.
-
TBH I think shortcodes are okay. The things we would be "shortcoding" are likely fairly small and I don't think I've ever seen a drive-by contributor want to modify that kind of content. It's usually more conceptual stuff that's not shared across language specific docs or code samples. |
Beta Was this translation helpful? Give feedback.
-
I agree that shortcodes are okay, and right now they do the job perfectly fine. But the thing I am looking for is something that helps to speed up the process of updating all that big and long pages like "Instrumentation" or "Exporters", which have multiple blocks that would need to be shortcoded then. If we look at the following pages https://opentelemetry.io/docs/languages/js/exporters/ they all share 80%+ of their content, it's mostly the code blocks and some special content (like JS has something around the browser). I want to have the same pages for all the other languages as well eventually, but every time I raise a PR suggestions on the wording are made, so we get a drift. Then people find a typo in one of them, it gets fixed, we get a drift, etc. We could sprinkle the text with multiple shortcodes ( |
Beta Was this translation helpful? Give feedback.
-
How does Hugo do the different "tabs" for different languages such as in https://gohugo.io/getting-started/configuration/? For intro topics where the bulk of the content is the same, would it be worth changing to a common topic and adding tabs for the respective languages? Ideally the TOC would be able to link to the document and deep link to the correct tab for the desired language. |
Beta Was this translation helpful? Give feedback.
-
Background
With meta issues like #3229, #3559 and #2623 we are in a process of providing consistency/standardization of our documentation across the language-specific documentation. The rational behind this is that
Problem
While we start to make good progress with this and see a lot of those changes emerging across the documentation, we currently have no consistent way of de-duplicating content, actually most content is copied and pasted and drifting from there, e.g. most of the content for https://opentelemetry.io/docs/languages/js/exporters/ was used to create https://opentelemetry.io/docs/languages/python/exporters/, or https://opentelemetry.io/docs/languages/java/instrumentation/ and https://opentelemetry.io/docs/languages/js/instrumentation/ also share some history.
For some content we have introduced shortcodes: https://github.com/open-telemetry/opentelemetry.io/tree/main/layouts/shortcodes/docs/languages, but those are a few exceptions, especially the first few paragraphs of a page. Of course, we could scale this mechanism out and create a short code for each text block, but I am not sure if this is the right thing to do:
Discussion
Besides the "short code" approach and the "copy&drift" non-approach, there are multiple other ways of addressing the de-duplication of content with hugo. I want to use this discussion to explore those approaches, hoping to find a "good enough" solution we can use. Below I kick of a list of solutions I am aware of, but please add more and let's discuss the pros and cons!
Solutions
{{ i18n "getting-started-introduction" . }}
.Beta Was this translation helpful? Give feedback.
All reactions