Different title for posts on the website vs meta

What I want to achieve:

For the title and other meta tags, I want to display titleA
For the title of the posts that are displayed internally, including main article lists or the article page itself, I want to display titleB

What I am getting instead:

Right now I have %title=better_title which points to a helper better_title in config.rb. The helper works just fine and modifies the title as I want but unfortunately, he will modify the title across the entire website.
It’s because my internal pages like index and article pages use article.title so once the helper from config.rb kicks in, it will modify it for all.

How can I structure it?

You can use additional frontmatter metadata to exclude pages that you don’t want to be processed. You put something like this into pages that need no title-processing:

---
exclude_title_processsing: true
title: "My page title"
---

And then in the layout.haml (or else) you check this:

- @title= current_page.data.exclude_title_processsing ? better_title : current_page.data.title
%title= @title

Why helper in config.rb instead of /helpers/custom_helpers.rb?