To use this website completely, it is necessary to store cookies on your computer.
 

* Navigator

Expand - Collapse

* Statistic


  • *Total Posts: 16430
  • *Total Topics: 2522
  • *Online Today: 5
  • *Most Online: 292
(12. Nov 2016, 09:37:31)
  • *Users: 0
  • *Guests: 0
  • *Spiders: 1
  • *Total: 1

  • *Google

* Calendar

Mo
Tu
We
Th
Fr
Sa
Su
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

Meta-tags managing

Started by atfosan, 01. Jul 2010, 13:57:01

previous topic - next topic

0 Members and 0 Guests are viewing this topic.

atfosan

01. Jul 2010, 13:57:01
Hello! I think that it wiill be great if in PortaMx admin center there is a function to manage meta-tags.

I would to make my portals pages able to indexing by search engines and I should to edit 2 template files. I needed to add Google Verification Meta-tag and I should edit one template file also. For favicon adding situation is similar.

There are mods for SMF that provide this feature but only for basic forum parts of template and for portal it doesn't work.
my SMF project with PortaMx - school site.

feline

#1
01. Jul 2010, 16:55:53
The Google Verification Meta-tag you can simple copy in the file /Sources/PortaMx/Portamx.php ..

Find:
Code Select

// load common javascrip
$context['html_headers'] .= '
<script language="JavaScript" type="text/javascript" src="'. $settings['default_theme_url'] .'/PortaMx/PortaMx.js"></script>';


Add the google code before the <script line like:
Code Select

$context['html_headers'] .= '
<meta name="google-site-verification" content="xxxxxxxxxxxxxxxx" />
<script language="JavaScript" type="text/javascript" src="'. $settings['default_theme_url'] .'/PortaMx/PortaMx.js"></script>';


And the favicon you can simple copy to your server document root.

Fel
Many are stubborn in relation to the path, a few in relation to the target.

atfosan

#2
01. Jul 2010, 18:03:28
I have a patch for my forum. Some strings from it:
Code Select
<file name="$themedir/PortaMx/Frontpage.template.php">
<operation>
<search position="replace"><![CDATA[<meta name="robots" content="noindex" />]]></search>
<add><![CDATA[<meta name="robots" content="index, follow" />]]></add>
</operation>
</file>

(That is for adding possibility to indexing main page by SE).

But it will be more convinience if I can change it it admin panel.

About favicon: if I want to use icon not from root directory or in png-format I need to write special link-tag.

And keywords... What shall I do if I want to write individual keywords for every single page?
my SMF project with PortaMx - school site.

feline

#3
01. Jul 2010, 20:12:38
Quote from: atfosan on 01. Jul 2010, 18:03:28
About favicon: if I want to use icon not from root directory or in png-format I need to write special link-tag.

You can convert any image to the .ico format ..
Quote
And keywords... What shall I do if I want to write individual keywords for every single page?

That is not possible ...

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Katrien

#4
08. Jul 2010, 16:11:16
Dear fel

Here i am again sorry.

I would like to add google analystic code. I understood i can add in doc as descriped above. But i get this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/oneplace/domains/1place4you.eu/public_html/Sources/PortaMx/PortaMx.php on line 159
can you help me pls?

I hope to hear from you soon

Thanks in advance
regards
Katrien


atfosan

#5
09. Jul 2010, 12:57:07
Quote from: Katrien on 08. Jul 2010, 16:11:16
Dear fel

Here i am again sorry.

I would like to add google analystic code. I understood i can add in doc as descriped above. But i get this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/oneplace/domains/1place4you.eu/public_html/Sources/PortaMx/PortaMx.php on line 159
can you help me pls?

I hope to hear from you soon

Thanks in advance
regards
Katrien


Try to replace apostrophes into tags to the quotes.
Code Select
' -> "
my SMF project with PortaMx - school site.

feline

#6
09. Jul 2010, 13:04:20
can you post the parts around the error line?

Fel
Many are stubborn in relation to the path, a few in relation to the target.

Katrien

#7
09. Aug 2010, 00:14:55
Howdy Feline

Many apologizes for my late reply. At the moment i am on vacation and the internet is terrible here.

As soon as i come home next week i will post all the info you need.

Regards
Katrien

Katrien

17. Aug 2010, 11:53:32 Last Edit: 17. Aug 2010, 20:02:40 by feline
goodmorning Fel

i tried again and i get this error with no further information:

Parse error: syntax error, unexpected T_STRING in /home/oneplace/domains/1place4you.eu/public_html/Sources/PortaMx/PortaMx.php on line 160

i do not know where to find the lines around the error, but i have attached the altered file.
I had to change the attached file name (added 1place to it) as the filename already exsists here

Can you please help me?

Thanks in advance
Kind regards
Katrien
Attach removed

feline

#9
17. Aug 2010, 12:10:57
If you have single quotes inside other single quotes, you must mask out them or use double quotes ...

Find this:
Code Select
// load common javascrip
$context['html_headers'] .= '
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17338450-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>


Replace with:
Code Select
// load common javascrip
$context['html_headers'] .= '
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "UA-17338450-1"]);
_gaq.push(["_trackPageview"]);
(function() {
var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);
})();
</script>


Fel
Many are stubborn in relation to the path, a few in relation to the target.

Katrien

#10
17. Aug 2010, 17:23:32
Dear Fel

Many thanks. No error anymore and google analytics is working  O0

Thanks again...i am happy that we've changed to your portal: good service/help from you and good portal.

Kind regards
Katrien

hartiberlin

#11
26. Jan 2011, 15:56:02
Would be cool,
if this could be included inside the admin panel,
so one does not have to modify any files manually...

Feline please could you add it into the PMX admin panel ?

Many thanks.

Regards, Stefan.

feline

#12
27. Jan 2011, 00:07:08
I think, that is not a good idea .. that make more problem as a good options.
Will you make the support for any option like this? we not ...

Fel
Many are stubborn in relation to the path, a few in relation to the target.

hartiberlin

#13
27. Jan 2011, 00:31:30
Okay, there is another Meta-Tag MOD, so we should use this one ?

Regards, Stefan.

feline

#14
27. Jan 2011, 14:42:58
For what you need a mod?
That can be simple done with a PortaMx special php block  ;)

1. Create a new Head block, type php.
2. Leave the SHOW Part empty.
2. Use the INIT PART editor and fill in what you will have in the <head> part as example:
Code Select

global $context;
$context['html_headers'] .= '
<meta name="google-site-verification" content="xxxxxxxxxxxxxxxxxxxxxxxx" />';

$this->visible = false;


Notes:
Use $context['html_headers'] .=  .. that is a string concat, to add the string to existings.
Add one tab char before each line.
Do not use single quotes inside the string.
Finalize the code with $this->visible = false;

Select ALL usergroups to see the block.
Save the block and enable it.
Now you find the line in the header, but the block itself is not exist.   ::)

Fel
Many are stubborn in relation to the path, a few in relation to the target.