Hugo .VS MediaWiki

Hi,

As stated in this post,(Document your work with Hugo) I’ve been using Hugo to document some of my projects. I was already using MediaWiki with XAMPP for a local Window Setup, but the nature of having everything in a format that is almost impossible to export (something MediaWiki is famous for), makes me nervous.

In short, if for some reason your MediaWiki installation becomes corrupted, you lose everything. Updating from version to version becomes a chore, and a dangerous one. Yes, you can export your content to XML, but if you have files added there too things turn into a mess pretty fast.

ENTER HUGO

I’m seriously considering moving everything to Hugo. With the inner links shortcode now added ({{< ref >}} Hugo seems like a very good rival to MediaWiki.

Yes, it is not a collaboration tool like MediaWiki, even though that can also be solved with a community installation of Hugo (one where contributors can also publish through GitHub). For a “solo practitioner” like myself, using a Wiki means only using the very core features.

  • Inner links ( again, ({{< ref >}} )
  • Templates ( Archetypes )
  • File upload ( ??? )
  • Edit content on page ( ??? )
  • Creating pages while on page ( ??? )

The last two items are the ones I’m actively working on right now. Uploading files can be as simple as writing a small javascript plugin that saves the files locally.

Now, editing content while on the page and creating pages while on page, this should be easy to fix, but since Hugo gets rebuilt every time we run the server, I’m doubting how it could be accomplished.

I guess you could edit the content of a single html with a inline markdown editor plugin, then write the content of the particular .md on the fly, so the next time you run the Hugo server, it would have your last change saved.

But to create pages using a template on the fly… not so sure.

Any idea are highly appreciated.

3 Likes

I would strongly recommend you have a look at “link render hooks” (a recent addition to Hugo), e.g. https://portable-hugo-links.netlify.app/ – for the linking.

1 Like

Do you think it would be possible to perhaps link the way wikipedia does?

{{ Wikinews | Pagename }} links to a page in the wikinews category.

Maybe a shortcode like that could be worked out.

For those who don’t know what we are talking about, refs work this way:

[About]({{< ref "/page/about" >}} "About Us")

And now, with link render hooks, they should work this way:

[About](../page/about.md)

Would there be a way of doing the same Wikimedia does but, without the “.md” added into the mix? Something that, perhaps, links to the page name and category, instead the file itself?

I’m thinking of something like:

{{ main "About Us" }}

Or

{{ about "My Projects" }} --> site.com/about/some-of-my-projects
{{ about "Contact me" }} --> site.com/about/contact-us
{{ games "The Eye of the Beholder" }} ---> site.com/games/beholder-game/
{{ games "Ishar 3" }} --> site.com/games/ishar-3/

I’m going to try to recreate that with a shortcode, not sure if Hugo will play along.

And, about editing content “on the fly”, while the server is running without having to edit the code itself for the rebuild. What would you recommend?

By the way, this post right here is enough reason for my to pursuit this path. Horrible.

Up to … you. I would prefer having the MD suffix if your source is living on GitHub or similar. That way you can also navigate it there.

So, you could maybe create some shortcode that mimics the Wikipedia linling, but …

I thought some part of this issue was to get away from the “vendor lock-in” situation, and it so, this is a more standard way of doing it (CommonMark):

[About](../page/about)

You can even do:

[About](about)

And handle the ambiguity in the background.

It may be a little harder to write for the end user, but even Wikipedia/MediaWiki is building lots of UI tooling on top of their product.

Addendum; I’m not sure if this is a valid commonmark link:

[About]

I doubt it, but if so, you could probably build the lookup logic based on the text.

Just checked, you need the parens, so currently this would be the simplest while still being CommonMark compliant:

[About]()
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.