klox7 VIP
Total posts: 914
02 Окт 2014 13:02

Hi,

in record you can have comments that have it's own header with h1 tag. I found this in com_cobalt\library\php\comments\cobalt\cobalt.php.

How can I change h1 to something else this without hacking core? Or even better how to add parameter in template?

Cheers

Последние изменения: 28 Нояб 2014


pepperstreet VIP
Total posts: 3,837
02 Окт 2014 15:46

Where do you get a H1 ? I could not find it in my test installation with default templates.
Do you mean core Comments and default comment template and default article template?

I just have H1 for the article/record header.
Comments header is H2.
Comments text is a DIV with ID#.


klox7 VIP
Total posts: 914
02 Окт 2014 18:57

Better to show it as image.

comments-header

I have word 'Reviews' as h1. I think I didn't change this. I searched through com_cobalt and I could only find it in path mentioned in 1st post.


pepperstreet VIP
Total posts: 3,837
02 Окт 2014 23:06

klox7 header with h1 tag. I found this in com_cobalt\library\php\comments\cobalt\cobalt.php.

Good catch!

Exactly the source for the H1. Unfortunately, it is hard-coded :(

Since we can't disable or customize the markup, we are forced to output a "wrong" heading tag. So, this can be considered an issue/problem. I have changed the topic type accordingly.

Suggestions/Ideas

  • Title should have an additional Comments parameter!
    (e.g. Title format -> Selectbox or free input with default)
  • Addtionally "Title" could have an option to be shown/hidden.
    (e.g. Title OFF/ON)

Sergey
Total posts: 13,748
03 Окт 2014 01:12

H2?


klox7 VIP
Total posts: 914
03 Окт 2014 06:29

pepperstreet Since we can't disable or customize the markup, we are forced to output a "wrong" heading tag.

Well I don't think it's "wrong" (multiple h1 is ok) I just prefer having page structured like a book.

Sergey H2?

Yes. Can I somehow change it in record template with str_replace?

pepperstreet

Suggestions/Ideas

  • Title should have an additional Comments parameter!

    (e.g. Title format -> Selectbox or free input with default)* Addtionally "Title" could have an option to be shown/hidden.

    (e.g. Title OFF/ON)

Agreed.


klox7 VIP
Total posts: 914
03 Окт 2014 08:29

And something else. I should be able to display comments anywhere in my record page, not just bellow. I think parameter for "Show comments under article" would be nice (or something like that) and in description you can say that you can include comments anywhere (regarding this setting) in template by adding

<?php echo $this->loadTemplate('comments');?>

Sergey
Total posts: 13,748
06 Окт 2014 02:59

But you already can include comments anywhere right?

klox7 Yes. Can I somehow change it in record template with str_replace?

Yes if you create system plugin.


klox7 VIP
Total posts: 914
08 Окт 2014 08:12

Sergey But you already can include comments anywhere right?

I can include comments by selecting comments provider in comments parameter in type.

And if I select this comments are displayed, if I don't select it coments are not displayed. So if I leave this empty and insert loadTemplate('comments');?> somewhere lese it doesn't work. That's way enable/disable comments under article button. If yes than comments are shown bellow article, if no comments will still be visible but only by inserting code. If I don't select comments provider than comments should be disabled totally.


Sergey
Total posts: 13,748
09 Окт 2014 11:02

Install latest cobalt today and just load comments anywhere you want in your article template without turning comments off in parameters.


klox7 VIP
Total posts: 914
09 Окт 2014 13:33

I added <?php echo $this->loadTemplate('comments');?> to my record template and comments are in that place. This was also before. How to turn off comments bellow article without hacking core?


pepperstreet VIP
Total posts: 3,837
09 Окт 2014 18:12

klox7 How to turn off comments bellow article without hacking core?

I remember, this was not an issue in ME RESOURCES... as soon as you called the comments area, the default output was removed automatically. Anyways, we are dealing with Cobalt here ;)

As far as I can see, the default output is ALWAYS called in:

../components/com_cobalt/views/record/tmpl/default.php

That means you have to create a J! template override in YourTemplate/HTML folder. :(


Maybe this should be improved.
If possible, either by the old ME RESOURCES logic. However it worked.
Or by removing the respective lines from default.php and put it directly in each record template?! So, it can be controlled by Cobalt template manager.


klox7 VIP
Total posts: 914
10 Окт 2014 06:28

pepperstreet as soon as you called the comments area, the default output was removed automatically.

This is exactly what I thought it would do after Sergey's comment. This would be great solution.


Sergey
Total posts: 13,748
13 Окт 2014 11:08

Fixed. In next version if you load comments in template it will disapear from the bottom automatically.


klox7 VIP
Total posts: 914
26 Окт 2014 14:11

Sergey Fixed. In next version if you load comments in template it will disapear from the bottom automatically.

Confirmed :)

Sergey H2?

Will heading for comments change?


jimie VIP
Total posts: 531
27 Окт 2014 15:30

I can confirm this issue, this part:

<div id="comments"> <div class="page-header"><h1>

should be changed to:

<div id="comments"> <div class="page-header"><h2> or <h3>

Having multiple

<

h1> tags on a page is not good for SEO

Rgds


pepperstreet VIP
Total posts: 3,837
27 Окт 2014 15:36

pepperstreet

Suggestions/Ideas

  • Title should have an additional Comments parameter! (e.g. Title format -> Selectbox or free input with default)

  • Addtionally "Title" could have an option to be shown/hidden. (e.g. Title OFF/ON)


klox7 VIP
Total posts: 914
27 Окт 2014 20:02

pepperstreet Title should have an additional Comments parameter! (e.g. Title format -> Selectbox or free input with default)

Agree.

pepperstreet Addtionally "Title" could have an option to be shown/hidden. (e.g. Title OFF/ON)

Workaround...just put whitespace in title input.


jimie VIP
Total posts: 531
16 Нояб 2014 16:34

@Sergey was this ever solved, because seams that still when using "Cobal types as comments" the title of comment section is still displayed under H1 tags, while it should be displayed under H2 tags instead

Rgds


Sergey
Total posts: 13,748
17 Нояб 2014 04:40

It is H2 in my source code.


jimie VIP
Total posts: 531
17 Нояб 2014 05:12

I just checked on a test website of mine and I see it still using H1 tags, as said, you need to use for comments "Cobalt types as comments"

Rgds

Работает на Cobalt