How to change Title format?

Jul 2, 2009 at 7:11 PM

I want to change "|" to "-" in the title (e.g.  "Blog | xxxxxx - browser" to Blog - xxxxxx - browser").  I choose to "Use blog name in page titles" I was unable to change "|" to "-". Where can I get it done for this?
Thank you in advance.

Jul 3, 2009 at 6:54 AM

You can change that in you default.aspx.cs page. It will be in the page_load event. Find out this line

Page.Title = BlogSettings.Instance.Name + " | ";

:Ajay

http://www.ajaymatharu.com

http://twitter.com/matharuajay

Jul 3, 2009 at 1:33 PM

I found this in default.aspx.cs. But I have chosen "Use blog name in page titles"in the admin. I had changed " | " to " - " already. It was not working in my case.

            if (!BlogSettings.Instance.UseBlogNameInPageTitles)
                Page.Title = BlogSettings.Instance.Name + " | ";

Jul 4, 2009 at 5:47 AM

Huey,

sorry I dint read the message completely, here is the solution,

protected override void OnPreRenderComplete(EventArgs e)
		{
			base.OnPreRenderComplete(e);
			if (BlogSettings.Instance.UseBlogNameInPageTitles)
			{
				Page.Title = (BlogSettings.Instance.Name + " - " + Page.Title);
			}
		}

You'll find this code in Blogengine.Core - Web - Controls - BlogBasePage.cs line 115

Please let me know if you need any more assistance :)

Regards,

Ajay Matharu

http://www.ajaymatharu.com

http://twitter.com/matharuajay

Jul 6, 2009 at 2:11 PM
Edited Jul 6, 2009 at 2:24 PM

Ajay,

Thanks a lot. It is working now.

Have a good day!

Huey

http://www.eformit.com/Blog/

Jul 8, 2009 at 4:28 PM

i'm sorry, but, after making modification in BlogBasePage.cs at BlogEngine.Core, then what should i do?

 

thank you in advance.

Jul 8, 2009 at 7:44 PM

rebuild the solution and upload stuffs in BlogEngine.Web/Bin. I guess. I just made my local machine works.

Jul 9, 2009 at 1:23 AM

huey,

 

i also want to change that " | " to become " - " or something else. change the value inside default.aspx.cs doesn't reflect other page. are you successfully on that? i cannot understand the tutorial by ajay. after making modification in the .Core, then what should i do? recompile? i don't have experience in this kind of modification. i thought that it is simply change the Page.Title value like other aspx scripting does.

Jul 9, 2009 at 1:19 PM

I just changed it and run the blog on my computer. That's it. Visual Studio would compile everything automaticly.

Jul 9, 2009 at 2:45 PM
Edited Jul 9, 2009 at 4:27 PM

ok, anyway i don't understand when it comes to compiling :D

anyway, i just did some modification in each of page, and inserting BlogSettings.Instance.Name + " - " + in the page.title, so that it will appear blogname in every page (not every page actually when we come to monthlist). anyway, it just looks ok.

Jul 9, 2009 at 5:14 PM

You don't need to do that much. Did you check the checkbox for "Use blog name in page titles" in the Admin?

Jul 10, 2009 at 10:11 AM

if i tick that checkbox, title would be blogname | pagename when i click other menu such as archive and so on. because i only find the setting for " | " at default.aspx file. only default.aspx would be changed.

Jul 10, 2009 at 1:28 PM

You should have both BlogEngine.Core and BlogEngine.Web on your machine, right? If don't, download and install to ensure they appear on your machine.

Then follow the instructions below:(from Ajay Matharu)

You'll find this code in Blogengine.Core - Web - Controls - BlogBasePage.cs line 115

protected override void OnPreRenderComplete(EventArgs e)
{
base.OnPreRenderComplete(e);
if (BlogSettings.Instance.UseBlogNameInPageTitles)
{
Page.Title = (BlogSettings.Instance.Name + " | " + Page.Title);
}
}

Just change " | " to " - ".

Please let me know if you need any more assistance :)

Regards,