No Code Attached Yet
avatar impressionestudio
impressionestudio
24 Aug 2021

I write below a list of simple but useful improvements to the HTML code of an article in order to expand its usability to the needs of today (CSS grid).

I created a demo article having a title, image, main text, article information and two custom fields before and after the main text.

Demo article

1. BETTER PLACEMENT OF THE CUSTOM FIELDS

The custom fields:

  • must be placed outside the ul/li elements,
  • must be placed on the same level as the main content, the title and the image
  • and must be placed inside divs.

(The custom fields may contain large texts, images, links, video players, photo galleries etc. So it is not good to be placed in ul/li elements.)

So the code for a custom field should change from:

<ul class="fields-container">
	<li class="field-entry city">
		<span class="field-label ">City: </span>
		<span class="field-value city">Athens</span>
	</li>
</ul>

to:

<div class="field-entry city">
	<span class="field-label ">City: </span>
	<span class="field-value city">Athens</span>
</div>

The code for the article part with the above changes is:

Custom fields code after the improvements

2. BETTER NAMES TO CLASSES

There is some inconsistency in the names of the CSS classes as it concerns the code of an article.
The class names:

  • should be smaller
  • should have a common logic

Specifically:

  1. The class “page-header” should be renamed to “title” since it represents the title field of an article.
  2. The class “item-image” should be only “image”. No need to use “item” since we don’t use it anywhere else in the rest class names.
  3. The class “com-content-article__body” is big. Maybe only “body” or “content” since it refers to the “Content” field of an article is better.
  4. The class “field-entry” should be renamed to “field” or “custom-field”.
  5. The class “article-info” should be renamed to “info”. The “article-“ part is redundant/obvious.
  6. The class “article-info-term” could change to “info-title”.
  7. The class “category-name” witch is part of the article information should be simply “category” since for example the class “published” is not “published-date”.

3. ARTICLE INFO

The article info code should be organized better:

  1. The labels of the article information like “Written by:” or “Category:” or “Published:” should be place in their own span elements
  2. They should have a specific class name “info-label” similar to “field-label” in the custom fields.
  3. The article info values should have a specific class name “info-value” similar to “field-value” in the custom fields.

So the code should change from:

Article info code before the changes

to:

Article info code after the changes

I wish the Joomla developers will agree with the above ideas.

Thank you!

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar impressionestudio impressionestudio - open - 24 Aug 2021
avatar impressionestudio impressionestudio - change - 24 Aug 2021
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 24 Aug 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 24 Aug 2021
avatar ReLater
ReLater - comment - 24 Aug 2021

Regarding "2. BETTER NAMES TO CLASSES". Joomla 4 uses at many places BEM nomenclature. http://getbem.com/naming/ . That was a deliberate decision.

avatar simbus82
simbus82 - comment - 24 Aug 2021

Agree with the proposal, escluding point 2 where the naming could be improved but not int that way.

avatar RickR2H
RickR2H - comment - 24 Aug 2021

Why not make a pull request? Just fork the Joomla repo and add your proposed changes so people can test and add comments.

avatar jwaisner jwaisner - change - 27 Aug 2021
Priority Urgent Medium
avatar jwaisner
jwaisner - comment - 27 Aug 2021

Adjusting priority to reflect proposal.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35342.

avatar EJBJane
EJBJane - comment - 30 Aug 2021

Thank you, this is super important to me as a designer.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35342.

avatar chmst
chmst - comment - 30 Aug 2021

@EJBJane I understand perfectly that every designer wants his or her own css classes and his or her own layout. Why not make a template override?

avatar impressionestudio
impressionestudio - comment - 30 Aug 2021

@EJBJane I understand perfectly that every designer wants his or her own css classes and his or her own layout. Why not make a template override?

Because the changes I suggest are useful for the most cases. It is better to have a code that needs override in 1 out of 10 times, not 9 times out of 10.

On the other side, as it is now and mostly the custom fields which are "locked" inside a ul/li element are completely hard to make good use of them and every time someone uses a couple of custom fields he/she needs to create an override.

Custom fields have the same importance as the description text (content in J4) so they shouldn't be separated like the article info details.

After all, the proposed code will slightly affect the appearance of the article with custom fields and article info details from the way it is now. Custom fields will continue to be placed before and after the description text and will continue to be one below the other. The only difference is that will not be in a ul/li element but only each custom field in a div.

avatar EJBJane
EJBJane - comment - 30 Aug 2021

@EJBJane I understand perfectly that every designer wants his or her own css classes and his or her own layout. Why not make a template override?

Because I am thinking the average user doesnt know how to make overrides? I wouldn't ask an average WP user to create overrides.

avatar EJBJane
EJBJane - comment - 30 Aug 2021

Because the changes I suggest are useful for the most cases. It is better to have a code that needs override in 1 out of 10 times, not 9 times out of 10.
Agree

avatar chmst
chmst - comment - 30 Aug 2021

@impressionestudio could you make a PR? Integrating custom fields surely can be improved.

@EJBJane I wouldn't ask an average WP user to create overrides.

This is Joomla.

avatar impressionestudio
impressionestudio - comment - 30 Aug 2021

@impressionestudio could you make a PR? Integrating custom fields surely can be improved.

I intend to do a PR but needs more time. I am not used to PRs.

avatar chmst
chmst - comment - 30 Aug 2021

Thank you! If you need support, don't hesitate to ask.

avatar impressionestudio
impressionestudio - comment - 30 Aug 2021

Ok. Thanks.

avatar EJBJane
EJBJane - comment - 30 Aug 2021

@impressionestudio could you make a PR? Integrating custom fields surely can be improved.

@EJBJane I wouldn't ask an average WP user to create overrides.

This is Joomla.

Yes, I do realize that. ;-) What's a PR?

avatar alikon
alikon - comment - 30 Aug 2021

stand for Pull Request

avatar EJBJane
EJBJane - comment - 1 Sep 2021

stand for Pull Request
Ok thanks..never done one.

avatar wohlkoenig
wohlkoenig - comment - 1 Sep 2021

Ok thanks..never done one.

@EJBJane if you wanna create a PR: My first pull request to Joomla! on Github

avatar impressionestudio
impressionestudio - comment - 3 Sep 2021

I read the instructions for creating a PR. I remember it is the second time I read the instructions and the conclusion is the same:
I am not going to install all these tools just for suggesting a few changes in some code. I know that everybody uses GitHub, but I don't like it, I don't use it, I don't like Java (Eclipse) and all these steps described are too much for me. So if you are going to accept the simple way of suggesting code changes, then I can continue. If not, then no problem, we can all forget this "issue".

avatar zero-24
zero-24 - comment - 3 Sep 2021

@impressionestudio simpler changes can be done without external tools and only the GitHub UI: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests

avatar impressionestudio
impressionestudio - comment - 6 Sep 2021

Please do not curse me. It is the first time I use Github.

The above changes have to do with better names on classes, following the BEM approach and removing some redundant classes.
A few changes remain in order this issue to be completely satisfied, but I will remain for a response from the experts before I continue.

avatar impressionestudio
impressionestudio - comment - 10 Oct 2021

How may I know if somebody will take a look at the suggested improvements and if they will be accepted?

avatar RickR2H
RickR2H - comment - 10 Oct 2021

@impressionestudio There has to be a pull request with the suggested code changes that can be tested. The easiest way to go if you want to change one file is via Github itself. please read: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests/en

The other option is to clone the repo in your own account, make the changes and the do a PR. Please read: https://opensource.com/article/19/7/create-pull-request-github

After two successful tests, the project team will decide if it will be added to the code base.

Hope that helps a bit.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35342.
avatar alikon
alikon - comment - 11 Oct 2021
avatar alikon alikon - change - 11 Oct 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-10-11 16:55:55
Closed_By alikon
avatar alikon alikon - close - 11 Oct 2021
avatar Fedik
Fedik - comment - 11 Oct 2021

@impressionestudio please merge all that changes in 1 pull request, and then we can review it.

avatar Fedik Fedik - change - 11 Oct 2021
Status Closed New
Closed_Date 2021-10-11 16:55:55
Closed_By alikon
avatar Fedik Fedik - reopen - 11 Oct 2021
avatar Fedik
Fedik - comment - 11 Oct 2021

@impressionestudio addittionaly, if you want to have an extra class, better add new to existing, this way it will not make hard time for templates.

And please check what @laoneo comment #35807 (comment)

avatar impressionestudio
impressionestudio - comment - 12 Oct 2021

@RickR2H Thank you for the guidance.

@Fedik Ok, I will add the new classes along with the existing ones in order not to brake templates. (I believe that in later versions of Joomla 4 the old classes will be removed.)

I will try to merge all the pull requests to one and add also the code changes in order the issue to be completely covered by this one pull request.

avatar Fedik
Fedik - comment - 12 Oct 2021

@impressionestudio thanks, and please not forget to look this RFC #15279, @ciar4n have made a big work to make classes more consistent.

avatar brianteeman
brianteeman - comment - 6 Feb 2022

This should be closed for the reasons stated by @bembelimen #36557 (comment)

avatar alikon alikon - change - 6 Feb 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-02-06 10:09:24
Closed_By alikon
avatar alikon alikon - close - 6 Feb 2022

Add a Comment

Login with GitHub to post a comment