scrivener_html v1.8.1 Scrivener.HTML.SEO View Source
SEO related functions for pagination. See https://support.google.com/webmasters/answer/1663744?hl=en for more information.
Scrivener.HTML.pagination_links/4
will use this module to add rel
to each link produced to indicate to search engines which
link is the next
or prev
ious 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 Scrivener.HTML.SEO.header_links/4
function requires the same arguments you passed into your Scrivener.HTML.pagination_links/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) View Source
header_links(paginator, opts) View Source
header_links(conn, paginator, opts) View Source
header_links(conn, paginator, args, opts) View Source
Produces <link/>
tags for putting in the <head>
to help SEO as recommended by Google webmasters.
Arguments are the same as Scrivener.HTML.pagination_links/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(Scrivener.HTML.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) View Source
Produces the value for a rel
attribute in an <a>
tag. Returns either "next"
, "prev"
or "canonical"
.
iex> Scrivener.HTML.SEO.rel(%Scrivener.Page{page_number: 5}, 4)
"prev"
iex> Scrivener.HTML.SEO.rel(%Scrivener.Page{page_number: 5}, 6)
"next"
iex> Scrivener.HTML.SEO.rel(%Scrivener.Page{page_number: 5}, 8)
"canonical"