Comment about getting random content

Open Beginner friendly
#293 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
documentation

Research direction

Start with the templatetags documentation page at https://docs.bolt.cm/templatetags and review the existing random-content examples. Document that fetching one record requires the returnsingle option, using the example from the issue. Done means the page clearly explains the single-record behavior alongside the existing query examples.

Written by the indexing model from the issue text.

Description

The docs page on https://docs.bolt.cm/templatetags gives a list of example queries, i.e. this one:

quote/random/5 - get 5 random quotes

But if you want to show just one, you'd think you can do this:
quote/random/1
That's not the case. If you want to fetch just one record, you have to do something like this:
{% setcontent myrecord = 'myrecord/random/1' returnsingle %}
The 'returnsingle' has to be used when fetching a single record in this example.

In my opinion this needs to be mentioned in the docs. :)

Dominant language
PHP
Stars
45
Forks
189
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bolt/docs

All issues in bolt/docs

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.