Welcome to Geeklog, Anonymous Thursday, November 21 2024 @ 03:40 pm EST
Geeklog Forums
Adding dynamic meta data to stories
Page navigation
Status: offline
ByteEnable
Forum User
Full Member
Registered: 10/20/03
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:
$_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":
<META NAME="description" CONTENT="{meta_description}">
<META NAME="keywords" CONTENT="{meta_keywords}">
storyeditor.thtml, add the following above intro_text:
<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:
$display .= COM_siteHeader ('menu', $pagetitle, $rdf,$A['meta_description'],$A['meta_keywords']);
lib-common.php, modify the COM_siteHeader function:
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:
$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
"meta_description" with a type of text, NULL
"meta_keywords" with a type of text, NULL
config.php, add:
Text 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":
Text Formatted Code
<META NAME="description" CONTENT="{meta_description}">
<META NAME="keywords" CONTENT="{meta_keywords}">
storyeditor.thtml, add the following above intro_text:
Text 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:
Text Formatted Code
$display .= COM_siteHeader ('menu', $pagetitle, $rdf,$A['meta_description'],$A['meta_keywords']);
lib-common.php, modify the COM_siteHeader function:
Text 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:
Text 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
30
34
Quote
Jesse
Anonymous
29
31
Quote
Status: offline
joshtravis
Forum User
Newbie
Registered: 10/05/05
Posts: 6
Location:Brighton TN
I think this should be default behavior for new releases of Geeklog.
31
26
Quote
Status: offline
beewee
Forum User
Full Member
Registered: 08/05/03
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:
Text 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
26
33
Quote
Status: offline
bjudson
Forum User
Junior
Registered: 01/01/04
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:
<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.
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:
Text 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>
This solution seems more scalable than the original cool_hack.
32
29
Quote
Status: offline
drshakagee
Forum User
Full Member
Registered: 10/01/03
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.
31
28
Quote
Status: offline
beewee
Forum User
Full Member
Registered: 08/05/03
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.
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
31
26
Quote
Status: offline
bjudson
Forum User
Junior
Registered: 01/01/04
Posts: 34
Quote by drshakagee:
If your meta data isn't dynamic why not just add it to your header.thtml file?
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
26
33
Quote
Status: offline
1000ideen
Forum User
Full Member
Registered: 08/04/03
Posts: 1298
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:
<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="??">
Text 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="??">
36
32
Quote
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?
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?
29
37
Quote
Status: offline
ByteEnable
Forum User
Full Member
Registered: 10/20/03
Posts: 138
Quote by Raven:
(1) Will it still work with current version of geeklog? No issues?
(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?
(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
26
28
Quote
Status: offline
Spirit_of_Martin
Forum User
Newbie
Registered: 07/28/05
Posts: 7
Hello
When i add meta to article, with this hack, then save it i got a error:
Warning: Illegal offset type in /system/lib-security.php on line 191
My geek is 1.3.11sr5
Any sugestion??
www.malach.org
When i add meta to article, with this hack, then save it i got a error:
Text Formatted Code
Warning: Missing argument 30 for submitstory() in /public_html/admin/story.php on line 919Warning: Illegal offset type in /system/lib-security.php on line 191
My geek is 1.3.11sr5
Any sugestion??
www.malach.org
39
28
Quote
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
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
31
30
Quote
ys
Anonymous
want solutions too!
38
22
Quote
Raven
Anonymous
Bump for last response
30
34
Quote
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
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?
30
28
Quote
Page navigation
All times are EST. The time is now 03:40 pm.
- 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