collapse

* User Info

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

* Who's Online

  • Dot Guests: 50
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • larry007: test
    November 20, 2014, 03:17:39 PM
  • {OCS}MasterSeal: HI, WhiteEagle
    November 12, 2014, 04:20:18 AM
  • WhiteEagle: Hello all.
    November 09, 2014, 05:33:00 PM
  • {OCS}MasterSeal: Oh and I almost forgot THANK YOU SP TEAM!
    November 04, 2014, 05:02:38 AM
  • {OCS}MasterSeal: I think I'll spam the shoutbox with as many SP IS AWESOME posts as I can.. but no more than one per day :
    November 04, 2014, 04:48:39 AM
  • desertcities: How long does it take to get approval here?  I posted on 10/29, my site is down, I need help.
    November 01, 2014, 08:50:30 PM
  • Zz: hello everyone! I posted a topic recently on Custom COdind section but it is still waiting for approval. Can anyone help with this?
    November 01, 2014, 04:21:31 PM
  • {OCS}MasterSeal: WOW> I'm so impressed at the developer involvement here at SP. Great stuff. Thank you!
    October 30, 2014, 11:42:03 PM
  • [SiNaN]: Feel free to customize it to your liking, however, this is the best we can currently offer.
    October 30, 2014, 08:19:04 AM
  • xeon365: ie where username profile link.. its just getting the membergroup color directly and adding it as inline style.. would be better if it instead just added the membergroup as a css class that can be styled by the theme
    October 29, 2014, 11:00:10 PM
  • xeon365: omg why isn't membergroup got proper css class.. not dumping inline css style
    October 29, 2014, 10:58:03 PM
  • BurkeKnight: [SiNaN] old friend. Great Job. I can't wait to see what you add next. :)
    October 13, 2014, 04:13:53 PM
  • [SiNaN]: Thank you everyone, for the kind words and support. For those who are interested, check out our Donators Program: [link]
    October 13, 2014, 11:57:44 AM
  • {OCS}MasterSeal: Glad to be here, glad to use your amazing portal THank you!
    October 13, 2014, 11:33:35 AM
  • Mike Vail: I'd like to donate to you for all your wonderful work. Do you guys have a place on your site to do that? THANKS FOR EVERYTHING!
    October 13, 2014, 11:12:16 AM
  • Mstcool: Yay, an update! :D
    October 12, 2014, 01:39:17 AM
  • stanyy: You're right. I have no idea how I got to the "Archived" index. It looks too similar.
    October 03, 2014, 11:38:32 AM
  • [SiNaN]: SimplePortal 2.3.5 package is listed in Stable SimplePortal Packages category in Downloads area.
    October 03, 2014, 06:08:01 AM
  • stanyy: SP 2.3.5 is not available in the downloads section?? The big download link on the homepage points newcomers to the downloads section who then download 2.3.4. Not good.
    October 03, 2014, 03:54:21 AM
  • Mulwa: if simpleportal team could make some of the blocks like articles to display photos just like how ebay does, it would be very great for shopping
    September 27, 2014, 08:24:14 AM

* Recent Posts

Re: Adding a navigation button by andy
[Today at 11:03:24 AM]


Creating custom block borders for Articles/blogs by cannabisgamer
[Yesterday at 08:34:42 PM]


Re: Adding a navigation button by Tonymura
[Yesterday at 02:41:18 AM]


Re: Adding a navigation button by Underdog
[November 22, 2014, 07:59:50 AM]


Re: Adding a navigation button by Tonymura
[November 22, 2014, 07:32:38 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: I want my Descriptive Title Appear in Home only  (Read 3989 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: 648
  • 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: 840
  • 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: 840
  • 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: 840
  • 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: 840
  • 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: 840
  • 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: 840
  • 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: 840
  • 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 »