Question

I have a wiki of recipes and want to put a "Random recipe" on the main page. Hope you can help me.

I look on the Wikimedia help but dind't found anytihng http://www.mediawiki.org/w/index.php?title=Special%3ASearch&profile=advanced&search=random+article&fulltext=Search&ns90=1&redirs=1&profile=advanced

This is the wiki that i'm working on http://lesmots.uy/labs/enciclochef

Thanks

Était-ce utile?

La solution

I believe you're looking for Extension:ArticleInclude. It allows you to overwrite the included article name with any random article on the wiki. It also allows you to limit the length, so that you only see a snippet of that article.

For your purposes, I'd imagine that the recipe title and/or ingredients would be sufficient. Including the ingredients may be tricky, since you list them at the top of the page in a simple list format. If you choose to go with the ArticleInclude extension, I'd recommend keeping your ingredients on a single line, and creating line breaks with HTML so that you could use the lines option to get what you need reliably.

Example, altered from Torta aromática:

<blockquote> 3 huevos <br> 3 cucharadas de leche <br> 6 cucharadas de manteca derretida <br> 1 ½ tazas de harina <br> ¾ tazas de azúcar <br> 2 cucharaditas de polvo de hornear <br> 2 cucharaditas de canela <br> ¼ cucharadita de clavo de olor molido <br> ½ cucharadita de cáscara de limón rallada </blockquote>

Relevant Options:

random: Overides article and shows a random article of the given namespaces
count: How many letters will be shown, negative values will display the whole article removing the specific number of letters from the end
lines: Count lines (not letters) that will be shown

Edit: If you don't want to bother with an Extension, Transclusion comes out-of-the-box since MediaWiki 1.8, but not with a random article function. You may have seen transclusion in action before on new user talk pages, where many wikis will commonly link to a page with helpful suggestions for new users.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top