Jump to content

How to add sitename to title


OllieMackJames
 Share

Recommended Posts

How can I add the domain name to the end of this:

<title><?php echo $page->get("seo_title|title"); ?></title>

par example: seo_title = Wonderful Catchy Thingies then the ouput will be: <title>Wonderful Catchy Thingies</title>

And I want it to be: <title>Wonderful Catchy Thingies | Mydomainname.com</title>

Thanks!

 

Link to comment
Share on other sites

Thanks Alxndre', I need one stepmore, cause this adds the Url as in like: https://www.domainname.com

I have now done it like this:

<title><?php echo $page->get("seo_title|title"); ?> | Domainname.com</title>

I think this will work for me, I hardly ever do any of this html coding, hence the noob question.

Once again Alxndr' thanks for thinking along!

 

 

Link to comment
Share on other sites

You could just add your own option in config.php

$config->prefix_sitename = 'my site name';
$config->prefix_title_separator = ' - ';

And use like this:

<title><?php echo $page->title . $config->prefix_title_separator . $config->prefix_sitename ?></title>

 

  • Like 1
Link to comment
Share on other sites

2 hours ago, szabesz said:

@OllieMackJames Are you looking for something like these?


<?php echo parse_url($page->httpURL,PHP_URL_HOST); ?>

or


 <?php echo $config->httpHost ?>

@ottogal was faster than me :)

HI szabesz, thanks, <?php echo parse_url($page->httpURL,PHP_URL_HOST); ?> gives me the www variant as well.

Just now saw the reply from fbg13, which gives me exactly what I need, thanks!

Link to comment
Share on other sites

17 minutes ago, fbg13 said:

You could just add your own option in config.php


$config->prefix_sitename = 'my site name';
$config->prefix_title_separator = ' - ';

And use like this:


<title><?php echo $page->title . $config->prefix_title_separator . $config->prefix_sitename ?></title>

 

This is the one! Added the 2 lines to my config.php and added this:

<title><?php echo $page->get("seo_title|title") . $config->prefix_title_separator . $config->prefix_sitename; ?></title>

Works like a charm, thanks fbg13!

Link to comment
Share on other sites

Make the file  /site/config.php  temporarily writeable and add this line:

$config->httpHost = 'domainname.com';

You can also add a "Whitelist" with the variants you want to allow in this way:

$config->httpHosts = array('yourdomain.com', 'www.yourdomain.com');

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...