Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide the ability to set a fixed suffix/prefix for the title #13

Open
aradalvand opened this issue Jan 13, 2021 · 2 comments
Open

Provide the ability to set a fixed suffix/prefix for the title #13

aradalvand opened this issue Jan 13, 2021 · 2 comments

Comments

@aradalvand
Copy link

aradalvand commented Jan 13, 2021

It happens fairly often where you want the titles across all the pages in your website to have a shared pattern.
For instance, no matter what page you're on in Stack Overflow, the title always ends with " - Stack Overflow".

It would be nice if this library provides a feature that allows users to achieve this, it would make it even more superior than it already is to Microsoft's built-in <Title> component.

I propose a property gets added to HeadElementHelperServiceOptions, so that you could do the following:

builder.Services.AddHeadElementHelper(op =>
{
    op.TitleSuffix = " | Tesla Motors";
});

Or something similar.
Without this, we currently have to repeat the suffix on every page:
(Products.razor)

<Title>Products | Tesla Motors</Title>

That way, this would suffice:

<Title>Products</Title>

Nicer, and cleaner.

There could also be a parameter for the <Title> component with which you can specify not to use the suffix, this is useful when for example you have a page whose title you want to be unique:

<Title UseSuffix="false">Tesla Motors Home Page</Title>
@jsakamoto
Copy link
Owner

@AradAral

Thank you for your interesting proposal!

However, what you want to do can be implemented without changing this library easily, I think.

I wrote a sample code (Please see the following URL).

Of course, this proposal is very interesting.
I can implement the feature that you suggested.

But I have to consider this suggestion well to keep simplify of this library.
Unfortunately, so I have some projects those wait to fix bugs by me, I can not start to consideration or implementation about this suggestion immediately.

Don't forget that you can create your own custom Title component derived from this library, and I'll welcome it.

@aradalvand
Copy link
Author

aradalvand commented Jan 15, 2021

@jsakamoto Hi! Thanks for your response.
I get your point, and you're right, I like your demonstration of how it can be done by the developer, I also like the idea of having your custom wrapper component, so I guess I'll probably do it that way. Thank you.
Feel free to close this issue if you decide that this is better not implemented as part of the library. I understand your situation.
Have a great day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants