Only split title suffix for tag titles

This commit is contained in:
Jeff Browning 2016-11-04 14:51:24 -04:00
parent 2f8e84eb8a
commit d3be3bdd82
2 changed files with 3 additions and 3 deletions

View File

@ -35,6 +35,8 @@ defmodule Readability.TitleFinder do
html_tree
|> Floki.find("title")
|> clean_title()
|> String.split(@title_suffix)
|> hd()
end
@doc """
@ -62,8 +64,6 @@ defmodule Readability.TitleFinder do
defp clean_title(html_tree) do
html_tree
|> Floki.text()
|> String.split(@title_suffix)
|> hd()
|> String.strip()
end

View File

@ -7,7 +7,7 @@ defmodule Readability.TitleFinderTest do
<html>
<head>
<title>Tag title - test</title>
<meta property='og:title' content='og title | test'>
<meta property='og:title' content='og title'>
</head>
<body>
<p>