collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 46
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • ♦ Ninja ZX-10RR ♦: I'm not admin nor a staff member... I tried connecting with a different IP and via proxy. No errors...
    Today at 01:15:06 pm
  • SeeingBlue: You've just been lucky, Ninja. There is a problem. Check your stats and see how many 500 error hits you've been getting.
    Today at 08:08:56 am
  • ♦ Ninja ZX-10RR ♦: The server might be have a high load but it still works here...
    Yesterday at 03:13:51 pm
  • sanb: i cant post a reply(
    Yesterday at 01:36:59 pm
  • SeeingBlue: It's intermittent. I bet if the admin logs into the cpanel they'll find either CPU or Ram hitting it's limit.
    Yesterday at 09:11:07 am
  • ♦ Ninja ZX-10RR ♦: The site works fine here...
    December 16, 2014, 11:01:27 am
  • SeeingBlue: I was finally able to make 1 post, but I can't edit it or make another. I'm frustrated, I give up.
    December 16, 2014, 08:49:37 am
  • SeeingBlue: I even tried a different browser. I'm just getting a 500 Internal Server Error.
    December 16, 2014, 08:30:15 am
  • SeeingBlue: When I "hit" post, sorry.
    December 16, 2014, 08:26:04 am
  • SeeingBlue: I'm trying to reply to my thread "Loading custom JS files" and when I get post it just loads a blank page.
    December 16, 2014, 08:25:43 am
  • Eliana Tamerin: Let's kick this over to his support topic, folks.
    December 03, 2014, 10:16:21 pm
  • Underdog: what is the issue with it? the naviagtion links? look here: [link]
    December 03, 2014, 09:54:07 pm
  • [SiNaN]: Oh! I didn't even see that. The author seems to have posted some instructions at the theme support topic at sm.org: [link]
    December 03, 2014, 02:11:58 pm
  • WhiteEagle: No the menu on top... the one that comes down when you mouse over it. ;)
    December 03, 2014, 02:02:35 pm
  • [SiNaN]: I already posted it!
    December 03, 2014, 01:51:11 pm
  • WhiteEagle: Any idea what I can do with the menu on top in that theme [SiNaN]?
    December 03, 2014, 01:28:25 pm
  • [SiNaN]: It's a pity that the theme author did that unusual thing for a rare good looking theme.
    December 03, 2014, 12:37:47 pm
  • WhiteEagle: *growls* It's annoying... I can't get SP working with my current theme at LS (Pulse) :(
    December 02, 2014, 10:48:34 pm
  • ♦ Ninja ZX-10RR ♦: SiNaN ftw :)
    November 29, 2014, 06:40:31 pm
  • k1mo0o: hi
    November 28, 2014, 08:54:15 pm

* Recent Posts

Re: php code by Oldcrow
[Yesterday at 10:12:38 pm]


Re: php code by Underdog
[Yesterday at 09:55:54 pm]


Re: [Block] Advanced Who's Online by stanyy
[Yesterday at 03:50:13 pm]


Re: php code by Oldcrow
[Yesterday at 03:45:50 pm]


Re: php code by Underdog
[Yesterday at 02:52:42 pm]

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 4042 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, 05: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 Bullet

  • Hero Member
  • *****
  • Posts: 2050
  • Gender: Male
  • $("li.blurb").hide();
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #1 on: February 01, 2013, 04: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.
Previously known as Leekoberries

Imagination rules the world.

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, 08: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, 03: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

  • Support
  • *
  • Posts: 659
  • Gender: Male
    • Outdoor Club Japan (OCJ) アウトドア・クラブ・ジャパン
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #4 on: February 04, 2013, 04: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, 07: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, 04:57:18 am by perfec2 »

Offline Underdog

  • Support
  • *
  • Posts: 917
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #6 on: February 04, 2013, 11:50:19 am »
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, 04: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, 01: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 Underdog

  • Support
  • *
  • Posts: 917
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #8 on: February 04, 2013, 04: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, 10: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 Underdog

  • Support
  • *
  • Posts: 917
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #10 on: February 05, 2013, 01: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, 02: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, 06: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, 04:48:24 am by perfec2 »

Offline Underdog

  • Support
  • *
  • Posts: 917
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #12 on: February 05, 2013, 07: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, 04: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 Underdog

  • Support
  • *
  • Posts: 917
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #14 on: February 06, 2013, 04: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, 05: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 Underdog

  • Support
  • *
  • Posts: 917
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #16 on: February 06, 2013, 02: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, 04: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, 04: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, 05:23:54 am by perfec2 »

Offline Underdog

  • Support
  • *
  • Posts: 917
  • Gender: Male
  • On Hiatus
    • WebDev
  • SMF Version: 2.0.9
  • SP Version: 2.3.6
Re: I want my Descriptive Title Appear in Home only
« Reply #18 on: February 06, 2013, 09: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, 02: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, 02:21:29 am by perfec2 »