collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 396
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: I want my Descriptive Title Appear in Home only  (Read 9032 times)

0 Members and 1 Guest are viewing this topic.

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
I want my Descriptive Title Appear in Home only
« on: February 01, 2013, 06:06:26 AM »
I want my descriptive title to appear in the Home index only not appearing in email members receive or boards.
For example when I go to Server Settings > core configuration and put my "Forum name" that becomes the forum name, which is fine.
But when I put "Forum name plus important keywords" That also appear in emails members get and forum boards as the forum name which don't want.

What can I edit to put descriptive words keywords I want to only display in HOME only not anywhere else or emails members get.
Note I'm using simply portal that is why I write here, as I have edited the language and got what I want but that only worked in myforumname.com/forum  but couldn't figure out how to make it work in Portal index page only which is the Home.


I will appreciate assistance in this regard.

 

Offline ccbtimewiz

  • Hero Member
  • *****
  • Posts: 2185
  • Gender: Male
  • $("div.content:dd").hide();
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
  • EhPortal Version: None
Re: I want my Descriptive Title Appear in Home only
« Reply #1 on: February 01, 2013, 05:46:10 PM »
So, based on the adaptions you've made already, you simply want to change the title of the page for the portal? This can be done fairly easy by editing the source file.

For SMF 1.1 and SMF 2.0:

Open /Sources/PortalMain.php

Within the sportal_main() function, find:

Code: [Select]
$context['page_title'] = $context['forum_name'];
Replace with:

Code: [Select]
$context['page_title'] = 'This is the title you want to use';
Change the text within the apostrophes after the equals sign. Do not add additional apostrophes without escaping them, such as:

$context['page_title'] = 'You\'re escaping the apostrophe!';

Make sure you backup the file before editing it, to avoid any problems.

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #2 on: February 01, 2013, 09:02:23 PM »
That solved it, thank you for your assistance.

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #3 on: February 04, 2013, 04:22:35 AM »
Is there any way I can also make the portal to have it's own metal Description and Keywords not using general forum own just like it has independent title.
Please what is the code to do this and how can I do it?

Offline andy

  • On Leave
  • *
  • Posts: 861
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
  • Elkarte Version: None
Re: I want my Descriptive Title Appear in Home only
« Reply #4 on: February 04, 2013, 05:51:18 AM »
I do not think it is possible to have different meta data with the portal page or with custom Simple Portal pages. I might be wrong...
It would be a nice idea for a feature of SP custom pages - have an admin setting for meta description and keywords.

This topic is discussed a lot on the SMF site and many developers there think it is not so important these days as the big search companies use the content on pages to index it.
Still, there are mods for SMF (search on their site) to help improve meta data, but nothing for Simple Portal I know of.

It could be done with custom code I guess.
Everyone is a volunteer here so please try and make a small donation to keep the Simple Portal website running


Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #5 on: February 04, 2013, 08:56:55 AM »
Thank you for your elaboration on this. I know if I put normal metal tags code it will appear, but I'm concern that I might mess things up because portal pull up "Description and keywords" of metal tags of the main forum, that is why I want to know from the owner of Simple portal.
« Last Edit: February 26, 2013, 05:57:18 AM by perfec2 »

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: I want my Descriptive Title Appear in Home only
« Reply #6 on: February 04, 2013, 12:50:19 PM »
perfec2,

  What you are requesting requires some manually editing of a file as attempting to edit the html client side via javascript or jQuery would be fruitless as search engine bots ignore javascript.

  Perform the edits shown below and your home page will have its own meta description & meta keywords as compared to the rest of your forum.

File: Sources/Subs.php

find:
Code: [Select]
// Set some specific vars.
$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
$context['meta_keywords'] = !empty($modSettings['meta_keywords']) ? $smcFunc['htmlspecialchars']($modSettings['meta_keywords']) : '';
}

Replace the above code with:
Code: [Select]
// Set some specific vars.
$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
$context['meta_keywords'] = !empty($modSettings['meta_keywords']) ? $smcFunc['htmlspecialchars']($modSettings['meta_keywords']) : '';

global $boardurl;
if (((!empty($modSettings['sp_standalone_url'])) && $modSettings['sp_standalone_url'] == currentPageURL()) || ($modSettings['sp_portal_mode'] != 0 && rtrim($boardurl, '/') == currentPageURL()))
{
$home_description = 'New Description';
$home_key_words = 'podcasts, mp3, music, movies';
$context['page_title_html_safe'] = $smcFunc['htmlspecialchars']($home_description);
$context['meta_keywords'] = $smcFunc['htmlspecialchars']($home_key_words);
}

}

/* Current url */
function currentPageURL($pageURL = 'http://')
{        
if (!empty($_SERVER["HTTPS"]))
$pageURL = "https://";

if ($_SERVER["SERVER_PORT"] != "80")
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
else
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 
$pageURL = str_replace('index.php', '', $pageURL);
return rtrim($pageURL, '/');


Adjust the following from the above to your specifics:
Code: [Select]
$home_description = 'New Description';
$home_key_words = 'podcasts, mp3, music, movies';
« Last Edit: February 04, 2013, 05:01:18 PM by Underdog »

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #7 on: February 04, 2013, 02:12:05 PM »
Does $home_title = 'New Title'; means "description" as I don't want to temper with the portal title as that has been taken care of by Bullet assistance above. All I want now are only "description and keyword" in the Portal only see example below, something that will give me result like:

<meta name="description" content="I describe what my lovely and informative forum is  " />
<meta name="keywords" content="Keyword 1,Keyword2, Keyword 3, Keyword 4, Keyword5 />

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: I want my Descriptive Title Appear in Home only
« Reply #8 on: February 04, 2013, 05:00:30 PM »
perfec2,

  Yes it will only change the meta description & key words on your home page as requested. I have now changed the language from the above post as not to confuse you.

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #9 on: February 05, 2013, 11:34:16 AM »
Thank you for clarification, I'm using 1.x version of smf, for pass 30 minutes now I couldn't find that very code, please in line what is that?

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: I want my Descriptive Title Appear in Home only
« Reply #10 on: February 05, 2013, 02:55:14 PM »
The edits I previously gave you were for SMF 2.0x

Here are the edits for SMF 1.1.16


File: Sources/Subs.php

find:
Code: [Select]
if (!isset($context['page_title']))
$context['page_title'] = '';
}

Replace with:
Code: [Select]
if (!isset($context['page_title']))
$context['page_title'] = '';

global $boardurl;
if (((!empty($modSettings['sp_standalone_url'])) && $modSettings['sp_standalone_url'] == currentPage()) || ($modSettings['sp_portal_mode'] != 0 && rtrim($boardurl, '/') == currentPage()))
{
$home_description = 'New description for home page';
$home_key_words = 'podcasts, mp3, music, movies';
}
else
{
$home_description = $context['page_title'];
$home_key_words = 'PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum';

}

$context['page_title'] = htmlspecialchars($home_description, ENT_QUOTES);
$context['meta_keywords'] = htmlspecialchars($home_key_words, ENT_QUOTES);

}

/* Current url */
function currentPage($pageURL = 'http://')
{        
if (!empty($_SERVER["HTTPS"]))
$pageURL = "https://";

if ($_SERVER["SERVER_PORT"] != "80")
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
else
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 
$pageURL = str_replace('index.php', '', $pageURL);
return rtrim($pageURL, '/');


File: Themes/default/index.template.php
(This edit will have to be performed for all themes that are available to your users)
Find:
Code: [Select]
<meta name="description" content="', $context['page_title'], '" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />

Replace with:
Code: [Select]
<meta name="description" content="', htmlspecialchars_decode($context['page_title']), '" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="', htmlspecialchars_decode($context['meta_keywords']), '" />
« Last Edit: February 05, 2013, 03:33:23 PM by Underdog »

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #11 on: February 05, 2013, 07:04:54 PM »
I can see this will address my need, however, I couldn't find the code to replace in my Sources/Subs.php 1.17 version of smf
« Last Edit: February 06, 2013, 05:48:24 AM by perfec2 »

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: I want my Descriptive Title Appear in Home only
« Reply #12 on: February 05, 2013, 08:25:54 PM »

perfec2,

 I found it without issue. Use ctrl-f (or cmd-f for apple) to find the text you are looking for.


Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #13 on: February 06, 2013, 05:20:41 AM »
The least of the forum works fine as expected, but that of Portal went and duplicated   $home_description = 'all my descriptions'      in the title by overwriting the portal title.

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: I want my Descriptive Title Appear in Home only
« Reply #14 on: February 06, 2013, 05:37:15 AM »
The least of the forum works fine as expected, but that of Portal went and duplicated   $home_description = 'all my descriptions'      in the title by overwriting the portal title.

perfec2,

  I do not understand the above statement. I provided you with edits that will change the meta tags for forum description & key words only on the home page & apply the default settings on all other pages. I do believe that is what was requested.  I can only assume you know how to apply those edits properly and omit any previous edits people gave you that may cause unwanted ouput.

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #15 on: February 06, 2013, 06:03:36 AM »
No previous edit code other than this thread. What I mean is metal tag descriptions on the portal appears in the portal title too by replacing the main portal title. But that of less of the forum is working as expected.

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: I want my Descriptive Title Appear in Home only
« Reply #16 on: February 06, 2013, 03:48:41 PM »
perfec2,

  The term in html language is meta tag, not metal tag.

  I believe I previously misunderstood. The meta description is the title of the page used by search engines & what you are trying to edit is the forum title just for the home page.

Change part of the code I previously gave you as such:
Code: [Select]
global $boardurl;
if (((!empty($modSettings['sp_standalone_url'])) && $modSettings['sp_standalone_url'] == currentPageURL()) || ($modSettings['sp_portal_mode'] != 0 && rtrim($boardurl, '/') == currentPageURL()))
{
$home_description = 'New description for home page';
$home_key_words = 'podcasts, mp3, music, movies, "testing!!"';
$home_title = 'Forum title for home page';
}
else
{
$home_description = $context['page_title'];
$home_key_words = 'PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum';
$home_title = $context['forum_name'];

}

$context['page_title'] = htmlspecialchars($home_description, ENT_QUOTES);
$context['meta_keywords'] = htmlspecialchars($home_key_words, ENT_QUOTES);
$context['forum_name'] = htmlspecialchars($home_title, ENT_QUOTES);

and in every theme's index.template.php

find all occurrences of (ie. default has 3 occurrences):
Code: [Select]
$context['forum_name']

replace with:
Code: [Select]
htmlspecialchars_decode($context['forum_name'])

« Last Edit: February 06, 2013, 05:11:43 PM by Underdog »

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #17 on: February 06, 2013, 05:58:27 PM »
I know is Meta tag, but for unknown reason be typing metal tag. Thank for calling my attention to it.

What I want is independent meta description and keywords of Portal (which the home www.thewebsite.com) to be different from the less of the forum which is www.thewebsite.com/forum.
I'm familiar with smf theme and know that Themes/default/index.template.php is the main index of all.
I'm here because of simple portal, Title issue has been addressed by Bullet above instruction, but want "Description and keywords address too if is possible.

Thank you for the good assistance so far.
« Last Edit: February 26, 2013, 06:23:54 AM by perfec2 »

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: I want my Descriptive Title Appear in Home only
« Reply #18 on: February 06, 2013, 10:54:38 PM »
I know is Meta tag, but for unknown reason be typing metal tag. Thank for caring my attention to it.

What I want is independent meta description and keywords of Portal (which the home www.thewebsite.com) to be different from the less of the forum which is www.thewebsite.com/forum.
I'm familiar with smf theme and know that Themes/default/index.template.php is the main index of all.
I'm here because of simple portal, Title issue has been addressed by Bullet above instruction, but want "Description and keywords address too if is possible.

Thank you for the good assistance so far.

perfec2,

  From what I understand I have produced the exact outcome that you have repeatedly requested.

  What I posted should allow you to have alternate/specific meta keywords, meta description & forum title on your portal home page and different one's on all the rest of your forum. If this is not what you require then perhaps someone else can understand what you are after and will respond to this thread.

Quote
Description and keywords address too if is possible.

I have addressed them & when I test the edits I gave you it works for me without issue.  The only thing that could possibly cause an issue here is the mod you are using to shorten the url but the logic I wrote should only change the meta (& title if opted) when the url is one that shows the portal home page.

Offline perfec2

  • Semi Newbie
  • *
  • Posts: 30
  • SMF Version: 1.1.6
  • SP Version: 2.3.5
Re: I want my Descriptive Title Appear in Home only
« Reply #19 on: February 26, 2013, 03:48:29 PM »
Thank you for the assistance, specially the one you gave me in other thread.
However, I have set up new forum in my localhost, and and still have "description contents"  appearing in the title.

All I want is description and keywords only for Portal  not effecting anything title or boards users use.

« Last Edit: February 27, 2013, 03:21:29 AM by perfec2 »