Only split title suffix for tag titles
This commit is contained in:
parent
2f8e84eb8a
commit
d3be3bdd82
|
@ -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
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue