zf v0.5.0 Zf.Pagination.SEO
SEO related functions for pagination. See https://support.google.com/webmasters/answer/1663744?hl=en for more information.
Zf.Pagination.zf_pagination/4 will use this module to add rel to each link produced to indicate to search engines which
link is the next or previous link in the chain of links. The default is rel value is canonical otherwise.
Additionally, it helps Google and other search engines to put <link/> tags in the <head>. The Zf.Pagination.SEO.header_links/4
function requires the same arguments you passed into your Zf.Pagination.zf_pagination/4 call in the view. However, header_links needs
to go into the <head> section of your page. See SEO Tags in Phoenix
for help with how to do that. The recommended option is to use render_existing/2 in your layout file and add a separate view to render that.
Link to this section Summary
Functions
Produces <link/> tags for putting in the <head> to help SEO as recommended by Google webmasters.
Produces the value for a rel attribute in an <a> tag. Returns either "next", "prev" or "canonical".
Link to this section Functions
header_links(paginator)
header_links(paginator, opts)
header_links(conn, paginator, opts)
header_links(conn, paginator, args, opts)
Produces <link/> tags for putting in the <head> to help SEO as recommended by Google webmasters.
Arguments are the same as Zf.Pagination.zf_pagination/4. Consider using one of the following techniques to
call this function: http://blog.danielberkompas.com/2016/01/28/seo-tags-in-phoenix.html
iex> Phoenix.HTML.safe_to_string(Zf.Pagination.SEO.header_links(%Scrivener.Page{total_pages: 10, page_number: 3}))
"<link href=\"?page=2\" rel=\"prev\"></link>\n<link href=\"?page=4\" rel=\"next\"></link>"
rel(arg1, page_number)
Produces the value for a rel attribute in an <a> tag. Returns either "next", "prev" or "canonical".
iex> Zf.Pagination.SEO.rel(%Scrivener.Page{page_number: 5}, 4)
"prev"
iex> Zf.Pagination.SEO.rel(%Scrivener.Page{page_number: 5}, 6)
"next"
iex> Zf.Pagination.SEO.rel(%Scrivener.Page{page_number: 5}, 8)
"canonical"