Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

記事一覧参照URLの変更 #1

Open
d-yuji opened this issue Oct 20, 2019 · 1 comment
Open

記事一覧参照URLの変更 #1

d-yuji opened this issue Oct 20, 2019 · 1 comment

Comments

@d-yuji
Copy link
Collaborator

d-yuji commented Oct 20, 2019

What

  • http://localhost:1313/postで記事の一覧を確認することができる
  • http://localhost:1313/ で記事一覧が確認できるようにしたい
@d-yuji
Copy link
Collaborator Author

d-yuji commented Oct 22, 2019

Inkblotty > layouts > index.html

{{ define "main" }}
{{ $paginator := .Paginate ( where .Site.RegularPages "Type" "post" ) 10 }}
<main aria-role="main">
  <header class="homepage-header">
    <h1>{{.Title}}</h1>
    {{ with .Params.subtitle }}
    <span class="subtitle">{{.}}</span>
    {{ end }}
  </header>
  <div class="homepage-content">
    <!-- Note that the content for index.html, as a sort of list page, will pull from content/_index.md -->
    {{.Content}}
  </div>
  <div>
    <!-- Note that .Pages is the same as .Site.RegularPages on the homepage template. -->
    {{ range $paginator.Pages }}
        {{ .Render "summary"}}
    {{ end }}
    <!-- ここに以下3行コメントアウトを入れるとなぜかうまく表示される。まじでわかんない -->
    <!-- {{ range .Site.Pages}} -->
      <!-- {{.Render "summary"}} -->
    <!-- {{ end }} -->
  </div>

{{ if gt $paginator.TotalPages 1 }}
{{ $current := $paginator.PageNumber }}
<div class="nav-links">
<ul class="pagination">
    {{ with $paginator.First }}
        <a href="{{ .URL }}" aria-label="First"><span aria-hidden="true">&laquo;</span></a>
    {{ end }}

    <a href="{{ if $paginator.HasPrev }}{{ $paginator.Prev.URL }}{{ end }}" aria-label="Previous"><span aria-hidden="true">Previous Page</span></a>
    {{ range $paginator.Pagers }}
    {{ if eq $current .PageNumber }}
    <span href="{{ .URL }}">{{ .PageNumber }}</a>
    {{ else }}
    <a href="{{ .URL }}">{{ .PageNumber }}</a>
    {{ end }}
    {{ end }}
    <a href="{{ if $paginator.HasNext }}{{ $paginator.Next.URL }}{{ end }}" aria-label="Next"><span aria-hidden="true">Next Page</span></a>
    {{ with $paginator.Last }}
    <a href="{{ .URL }}" aria-label="Last"><span aria-hidden="true">&raquo;</span></a>
    {{ end }}
</ul>
</div>
{{ end }}
{{ partial "ad_double_rectangle.html" . }}
</main>

{{ end }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant