How to create a pagination for a single file

I am using blogdown package in R to build a static website. I am trying to display number of tweets and want to create pagination for them say 5 tweets on one page. I have set pagination parameter as 5 in config.toml and have modified the template like this :

{{ partial "header.html" . }}

<section id=content>
{{ $paginator := .Paginate (where .Data.Pages.ByLength "Section" "post") }}
  <ul class=posts_listing>
    {{ range $paginator.Pages }}
      <li>
        <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
        <div id=date>
          <time>{{ .Date.Format "2006/01/02" }}</time>
        </div>
      </li>
    {{ end }}
  </ul>
{{ template "_internal/pagination.html" . }}
</section>

{{ partial "footer.html" . }}

I think I need to change this line {{ $paginator := .Paginate (where .Data.Pages.ByLength "Section" "post") }} to make it work. Also don’t think Data.Pages is correct as I have only one file to display.

I am using shortcode to render the tweets and it has HTML like :

--- title: shahronak47 author: '' date: '2018-07-05' slug: shahronak47 categories: [] 
 tags: [] --- {{% tweet "1018342908209057792" %}} {{% tweet "1018342826059284480" %}} 
{{% tweet "1018343292902301696" %}} {{% tweet "1018340795705749505" %}} 
{{% tweet "1018338619902214144" %}} {{% tweet "1018341886585536514" %}} 
{{% tweet "1018340892611104768" %}} {{% tweet "1018343291866222592" %}} 
{{% tweet "1018343175323373569" %}} {{% tweet "1018342199799541760" %}} 
{{% tweet "1018339385270525952" %}} {{% tweet "1018341946924896258" %}} 
{{% tweet "1018341897864179712" %}} {{% tweet "1018340635781328896" %}} 
{{% tweet "1018342979659059200" %}} {{% tweet "1018342870686855168" %}}

I have been reading lot of questions and online material since 3-4 hours and have tried various things still this doesn’t work and it renders all the tweets in single page itself. How can I achieve this?

The paginate feature in Hugo is for listing multiple pages, rather than content on a single page. I don’t know of a way to paginate a single piece of content across separate HTML files.

I don’t think you are going to get what you are looking for with Hugo at present. Maybe as creating pages from data sources develops. Good luck! :slight_smile: