How to generate just 1 page ex. index.html

hi there.
I use random list in my homepage. and I only want generate/build index.html - only 1 page
(because every 1 time generated the homepage will list new random content list for user)
how can I do it.(what command can generate 1 page/index.html)

I do not understand your question.

  • If I understand it correctly, you need to generate a website that has only one HTML page, the index.html. Correct?
  • How do you plan to generate the “random list”? What is the source of the random content?

sorry. English poor
Emm. my site have lot of pages. ex. 1000000 and more. if build all of them. need a lot of time.
but if can just build index.html(when builded all of pages ) user can read all of them by random content list in homepage because I can setting every 1 minute to build index.html once.
I just know how to build all of pages but cant build just 1 page

the site have lot of pages. but I want only build index.html every time after build all of them.

You cannot selectively build one page.

If I understand correctly, you rebuild your site very often to randomize content on the front page. If true, why not use JavaScript to randomize the content instead?

can use Javescript to build random list with index.html?
I never thought so
can give some example for me? thanks maybe it can work.

Add an output format to build a JSON file when you build your site. It will be an array of pages containing title, relative permalink, and summary.

The JS on the home page would select 10 random elements from the JSON array, iterate through the list, and render.

If your site has 1 million pages the JSON file will be too large. Find a way to limit its size. You could:

  • Include the last N pages created, or
  • Select N random pages

N might be 100, 200, 500. It’s a trade-off between size/performance and content variability.

In either case, rebuild the site when you (a) create new content, or (b) once every few days.

thanks a lot.
I will try it soon.
very nice solutions for me.

1 Like

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