Welcome to Geeklog Wednesday, October 18 2017 @ 01:30 am EDT


Status: offline

ByteEnable

Forum User
Full Member
Registered: 20/10/2003
Posts: 138
Insert two rows into your gl_stories table of your geeklog database:
"meta_description" with a type of text, NULL
"meta_keywords" with a type of text, NULL

config.php, add:
PHP Formatted Code

$_CONF['meta_description'] = "The coolest website ever!";
$_CONF['meta_keywords'] = "my,keywords,rank,high,in,google";


 

header.thtml, add the following somewhere in the "head":
PHP Formatted Code

<META NAME="description" CONTENT="{meta_description}">
<META NAME="keywords" CONTENT="{meta_keywords}">

 

storyeditor.thtml, add the following above intro_text:
PHP Formatted Code

<tr>
  <td valign="top" align="right">Meta Desc:</td>
  <td><textarea name="meta_description" cols="60" rows="2">{story_meta_description}</textarea></td>
</tr>
<tr>
  <td valign="top" align="right">Meta Keywords:</td>
  <td><textarea name="meta_keywords" cols="60" rows="2">{story_meta_keywords}</textarea></td>
</tr>


 

article.php, modify the COM_siteHeader (around line 150) function call:
PHP Formatted Code

$display .= COM_siteHeader ('menu', $pagetitle, $rdf,$A['meta_description'],$A['meta_keywords']);


 

lib-common.php, modify the COM_siteHeader function:
PHP Formatted Code

function COM_siteHeader( $what = 'menu', $pagetitle = '', $headercode = '',$meta_desc='',$meta_key='')

around line 579 or so add:

if ( !empty($meta_desc))
  $_CONF['meta_description'] = $meta_desc;
if ( !empty($meta_key))
  $_CONF['meta_keywords'] = $meta_key;
$header->set_var(meta_description,$_CONF['meta_description']);
$header->set_var(meta_keywords,$_CONF['meta_keywords']);


 

story.php, add the following around 579:
PHP Formatted Code

$story_templates->set_var('story_meta_description',$A['meta_description']);
$story_templates->set_var('story_meta_keywords',$A['meta_keywords']);

modify the submitstory function with meta data:

function submitstory($type='',$sid,$uid,$tid,$title,$introtext,$bodytext,$hits,$unixdate,$expiredate,$comments,$featured,$commentcode,$trackbackcode,$statuscode,$postmode,$frontpage,$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$delete,$show_topic_icon,$meta_description,$meta_keywords,$old_sid)

just before the DB_save call in function submitstory add:
$meta_description = addslashes($meta_description);

Modify the DB_save with the meta data:
DB_save ($_TABLES['stories'],'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,
trackbackcode,statuscode,expire,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,
perm_group,perm_members,perm_anon,show_topic_icon,in_transit,meta_description,meta_keywords'
, "'$sid',$uid,'$tid','$title','$introtext','$bodytext',$hits,FROM_UNIXTIME($unixdate),'$comments','$related',$featured,'$commentcode','$trackbackcode','$statuscode',FROM_UNIXTIME($expiredate),'$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon,1,'$meta_description','$meta_keywords'");

around line 1100 or so add the meta data:
COM_applyFilter ($_POST['show_topic_icon']), <- dont add this

COM_stripslashes ($_POST['meta_description']),
COM_stripslashes ($_POST['meta_keywords']),

COM_applyFilter ($_POST['old_sid'])); <- dont add this


 

Jesse

Anonymous
Great hack! I am looking for this.

----------
Solidot.org - China Slashdot Site Powered by Geeklog

Status: offline

joshtravis

Forum User
Newbie
Registered: 05/10/2005
Posts: 6
Location:Brighton TN
I think this should be default behavior for new releases of Geeklog.

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/2003
Posts: 969
Location:The Netherlands, where else?
Quote by joshtravis: I think this should be default behavior for new releases of Geeklog.


Yep, but also in another way: display the keywords as 'tags'. An alternative for posting to multiple topics I guess. How can I display the keywords the way Technorati etc like it in my story? See this:

PHP Formatted Code
<a href="http://technorati.com/tag/[tagname]" rel="tag">[tagname]</a>
 

Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net

Status: offline

bjudson

Forum User
Junior
Registered: 01/01/2004
Posts: 34
Adding the dynamic tags like sotry keywords and such make sense to do with code;
but a field should exist either in the config file, or in the database to add SOMETHING to all templates area.

An example that I always use is GeoURL:
PHP Formatted Code
<meta name="ICBM" content="49.13481, -102.99079" />
<meta name="DC.title" content="Ben And Amys Place" />
<meta anything .... />
<meta more .... />
<script type=anything>

 
Even with one "HEAD" field to edit you could add your GEO URL, meta_descriptions, meta_keywords, even custom javascript to spam-proof email addresses etc.

This solution seems more scalable than the original cool_hack.


Status: offline

drshakagee

Forum User
Full Member
Registered: 01/10/2003
Posts: 231
Quote by bjudson:but a field should exist either in the config file, or in the database to add SOMETHING to all templates area.



If your meta data isn't dynamic why not just add it to your header.thtml file?
Yes I am mental.

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/2002
Posts: 13073
Location:Stuttgart, Germany
Technorati-style tags can be implemented as a plugin.

bye, Dirk

Status: offline

beewee

Forum User
Full Member
Registered: 05/08/2003
Posts: 969
Location:The Netherlands, where else?
That's all. This is a plugin (you have to create the entry in the
plugins table yourself, then safe it as plugins/tags/functions.inc)
which provides a [tag:] autotag. Now just insert the tags somewhere in
the text and it will collect them and list them at the end of the text.


So if i write a story about swimming in Miami I would have to write it like this:

I love [tag: swimming] in [tag:Miami].

Am I correct?

And, since I'm no developer, is somebody interested in making it a normal plugin? Making new templates should not be necessairy, if there is a {} tag we can put in the story and header template somewhere.
Dutch Geeklog sites about camping/hiking: www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net

Status: offline

bjudson

Forum User
Junior
Registered: 01/01/2004
Posts: 34
Quote by drshakagee:
Quote by bjudson:but a field should exist either in the config file, or in the database to add SOMETHING to all templates area.



If your meta data isn't dynamic why not just add it to your header.thtml file?


The only reason I would do it at the core is so it would affect all templates. Users could download other templates, and not worry about having to modify them all the time.

Further functionality, like the new editor could use this functionality as well. Why call it with a plugin API, if the functionality is used at the core of serving pages? It's just extra overhead.

-Ben


Status: offline

1000ideen

Forum User
Full Member
Registered: 04/08/2003
Posts: 1289
Yes, I think the idea of flexible meta data is great. Though one should consider some more fields like this and maybe 1-3 open fields to be defined somewhere:

PHP Formatted Code

<meta name="language" content="??">
<meta name="topic" lang="??" content="??">
<meta name="type" lang="??" content="??">
<meta name="audience" lang="??" content="??">
<meta name="description" lang="??" content="??">
<meta name="keywords" lang="??" content="??">


 

Raven

Anonymous
Hello,

Two questions about this.

(1) Will it still work with current version of geeklog? No issues?

(2) How about for my index page, how do I get the meta dialog to appear there?

Status: offline

ByteEnable

Forum User
Full Member
Registered: 20/10/2003
Posts: 138
Quote by Raven:
(1) Will it still work with current version of geeklog? No issues?

Yeah

Quote by Raven:
(2) How about for my index page, how do I get the meta dialog to appear there?


All pages will display the meta data, its in the header. For index pages and such it will display the default data that you have defined in config.php

Status: offline

Spirit_of_Martin

Forum User
Newbie
Registered: 28/07/2005
Posts: 7
Hello

When i add meta to article, with this hack, then save it i got a error:

PHP Formatted Code
Warning: Missing argument 30 for submitstory() in /public_html/admin/story.php on line 919

Warning: Illegal offset type in /system/lib-security.php on line 191

 


My geek is 1.3.11sr5

Any sugestion??
www.malach.org

Status: offline

Robin

Forum User
Full Member
Registered: 15/02/2002
Posts: 725
confused
Something ain't right with this hack.
I introduced all the changes, hack seems to work as I can add meta desc and keywords and they are actually saved in the db. However when you click on a story and then look into the source there is nothing there, expcept for the meta data from config.

GL 1.4.0sr2

Any help much appreciated
Geeklog Polish Support Team

Status: offline

Robin

Forum User
Full Member
Registered: 15/02/2002
Posts: 725
working
I suspect that the problem is with lib-common.php part.

Could you please post the piece of code from lib-common with this additional code? Where does it go exactly?

Thanks

Robert
Geeklog Polish Support Team

ys

Anonymous
want solutions too!

Status: offline

Robin

Forum User
Full Member
Registered: 15/02/2002
Posts: 725
Could someone please confirm that this hack actually works works on 1.4.0. ?
TIA
Geeklog Polish Support Team

Raven

Anonymous
Bump for last response

GGGGG

Anonymous
Quote by Robin: Something ain't right with this hack.
I introduced all the changes, hack seems to work as I can add meta desc and keywords and they are actually saved in the db. However when you click on a story and then look into the source there is nothing there, expcept for the meta data from config.

GL 1.4.0sr2

Any help much appreciated


Bump, having same problem, any solutions?

Status: offline

Scotsman

Forum User
Newbie
Registered: 23/06/2002
Posts: 14
for lib-common.php where it says around line 579, instead place it at about line 975. I placed it after $charset = $LANG_CHARSET; and works fine.

All times are EDT. The time is now 01:30 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content