Advertisement
Anchor to title of article
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Tue Oct 19, 2010 12:08 am
Anchor to title of article
Hi,
I wonder if anyone can help. I would like to add an anchor to an article title (or just above) so links from the menu navigates down but still shows the title.
I already added code from another post:
http://forum.joomla.org/viewtopic.php?f=178&t=444075
to add anchor text to an article but the title is cut off as it only links to the main article body and so makes navigation a little confusing.
Here is an example:
http://www.cloudcreative.co.uk (links from top menu)
Also, this does not work for the contact article as you cannot edit the HTML. Or the default home link as if you select it as default, #mainbody anchor is not added.
Is there a solution for these issues?
Many thanks in advance for the help.
I wonder if anyone can help. I would like to add an anchor to an article title (or just above) so links from the menu navigates down but still shows the title.
I already added code from another post:
http://forum.joomla.org/viewtopic.php?f=178&t=444075
to add anchor text to an article but the title is cut off as it only links to the main article body and so makes navigation a little confusing.
Here is an example:
http://www.cloudcreative.co.uk (links from top menu)
Also, this does not work for the contact article as you cannot edit the HTML. Or the default home link as if you select it as default, #mainbody anchor is not added.
Is there a solution for these issues?
Many thanks in advance for the help.
Advertisement
- factor41
- Joomla! Apprentice
- Posts: 10
- Joined: Tue Jun 30, 2009 1:52 pm
Re: Anchor to title of article
Bump!
I'm after something very similar. I'm linking from side menus to simple #anchors as an external URL menu type to a point within a Category Blog layout. I can link to anchors within the individual articles without a problem, but would like to get the anchor in or just above the article title.
I imagine it would be fairly simple to use a field such as the keyReference field and put an anchor name into there, then when the page is assembled, simply check for it like
And if it exists for that article, drop in the anchor with that name in just before the title. Unfortunately, I can't make head nor tail of the PHP files where Joomla is actually assembling the file so can't figure out where or how to implement this.
If anyone could shed any light, I'd be very grateful!
Thanks
I'm after something very similar. I'm linking from side menus to simple #anchors as an external URL menu type to a point within a Category Blog layout. I can link to anchors within the individual articles without a problem, but would like to get the anchor in or just above the article title.
I imagine it would be fairly simple to use a field such as the keyReference field and put an anchor name into there, then when the page is assembled, simply check for it like
Code: Select all
if ($params->get('keyref')) { ...
If anyone could shed any light, I'd be very grateful!
Thanks
- factor41
- Joomla! Apprentice
- Posts: 10
- Joined: Tue Jun 30, 2009 1:52 pm
Re: Anchor to title of article
Ok, been doing some digging and I've found that the file within my template>html>com_content_category>blog_item is the bit that I can add in so I get an anchor above each title. Can anyone tell me what I would need to add as the name part in order to get the key reference to be used as the anchor name. Something like...
(I'm guessing it's not as simple as that, because this doesn't work!)
Thanks
Code: Select all
<?php if ($this->item->params->get('show_title')) : ?>
<a name="<?php $this->item->params->get('keyref') ?>"></a>
<h2 class=...
Thanks
- factor41
- Joomla! Apprentice
- Posts: 10
- Joined: Tue Jun 30, 2009 1:52 pm
SOLVED!
SORTED IT! - silly me, forgot to actually echo the variable. Potski205 - this looks like it solves your problem as it has mine.
For creating anchors for each article in a category blog, simply go to the file yourTemplate>html>com_content>category>blog_item and just before the <h2> which creates the item header, insert the line...
With this in place, if you put in a value in the Key Reference box on your article, it will create an anchor with that name, just above your article header.
If you want something similar on a section blog, frontpage or individual article layout, there are similar files within that template folder.
For creating anchors for each article in a category blog, simply go to the file yourTemplate>html>com_content>category>blog_item and just before the <h2> which creates the item header, insert the line...
Code: Select all
<?PHP if( strlen($this->item->params->get('keyref')) > 0 ) { echo '<a name="'.$this->item->params->get('keyref').'"></a>'; } ?>
If you want something similar on a section blog, frontpage or individual article layout, there are similar files within that template folder.
-
- Joomla! Enthusiast
- Posts: 110
- Joined: Sun Jul 25, 2010 3:02 pm
Re: Anchor to title of article
Not working for me, its not picking up keyref, when i remove the if statement it shows the <a name.....
but it has nothing in it.
Is 'keyref' the correct parameter?
but it has nothing in it.
Is 'keyref' the correct parameter?
-
- Joomla! Fledgling
- Posts: 3
- Joined: Mon Dec 20, 2010 12:30 pm
Re: Anchor to title of article
What exactly can you do with an anchor text? Does it help spreading the side and getting more readers? How do you prove that the anchor text really is working and actually helping out your page?
What is the actual myth about having an anchor text - is it really necessary?
What is the actual myth about having an anchor text - is it really necessary?
-
- Joomla! Enthusiast
- Posts: 110
- Joined: Sun Jul 25, 2010 3:02 pm
Re: Anchor to title of article
@miller
you seem to have anchor text confused with something else SEO.
Anchor text means you can navigate to a certain part of your page.
So if i wanted to link someone to a paragraph half way down a page I could do it with an anchor text.
http://en.wikipedia.org/wiki/Anchor_text
you seem to have anchor text confused with something else SEO.
Anchor text means you can navigate to a certain part of your page.
So if i wanted to link someone to a paragraph half way down a page I could do it with an anchor text.
http://en.wikipedia.org/wiki/Anchor_text
- factor41
- Joomla! Apprentice
- Posts: 10
- Joined: Tue Jun 30, 2009 1:52 pm
Re: Anchor to title of article
Yes, keyref seems to work fine for me - just put the text in the keyref box on the article and it appears in the code. Don't include the '#' in the name.jayflux wrote:Not working for me, its not picking up keyref, when i remove the if statement it shows the <a name.....
but it has nothing in it.
Is 'keyref' the correct parameter?
Are you sure you copied the code exactly?
-
- Joomla! Apprentice
- Posts: 14
- Joined: Sun Dec 18, 2011 12:48 pm
Re: Anchor to title of article
Hi, I have come across this problem and want to link to an article title rather than a category blog. Being a newbie a bit unsure which file I need to alter and which part of it. Any help would be much appreciated.
- offhegoes
- Joomla! Apprentice
- Posts: 31
- Joined: Fri Aug 15, 2008 5:27 pm
- Location: Bandar Baru Bangi, Selangor, Malaysia
- Contact:
Re: Anchor to title of article
Hi, I solved this issue & I am running on Joomla! 2.5
Solutions: Every article will have an anchor named #titlearticle or whatever name you would like to have, it will be use by the menu to call later.
How:
1. Open file at the location /templates/<template_name>/html/joomla/2.5/com_content/article/default.php
Example: /templates/rt_chapelco/html/joomla/2.5/com_content/article/default.php
2. Look for this code at line 36. Before that line, add one new line of code
3. Then, you can add a menu with that anchor.
Example: http://www.huemedia.com.my/index.php/co ... tlearticle
Hope this will help everyone who would like to have this solution.
Thanks
Solutions: Every article will have an anchor named #titlearticle or whatever name you would like to have, it will be use by the menu to call later.
How:
1. Open file at the location /templates/<template_name>/html/joomla/2.5/com_content/article/default.php
Example: /templates/rt_chapelco/html/joomla/2.5/com_content/article/default.php
2. Look for this code
Code: Select all
<div class="rt-article-title">
Code: Select all
<a name="titlearticle"></a>
Example: http://www.huemedia.com.my/index.php/co ... tlearticle
Hope this will help everyone who would like to have this solution.
Thanks
Advertisement