How can i call the "Article Title" via a module?

General questions relating to Joomla! 5.x.

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.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

How can i call the "Article Title" via a module?

Post by joomlerGR » Thu Apr 18, 2024 4:17 pm

How can i call the "Article Title" via a module?

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9842
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: How can i call the "Article Title" via a module?

Post by AMurray » Thu Apr 18, 2024 10:02 pm

Exactly what do you mean by that? Please explain in further detail what you want to achieve.
Regards - A Murray
General Support Moderator

joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

Re: How can i call the "Article Title" via a module?

Post by joomlerGR » Sat Apr 20, 2024 7:57 pm

i want to display-call the current article title via module at the "banner" position because i will hide the current one:
<div class="page-header">
<h1 itemprop="headline">
ARTICLE TITLE </h1>
You do not have the required permissions to view the files attached to this post.

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9842
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: How can i call the "Article Title" via a module?

Post by AMurray » Sat Apr 20, 2024 9:27 pm

Sorry, I'm still at a loss as to what you want to do; I will take a shot in the dark:
  • Create a custom module
  • Name the module after the article title. The module content will also show the text that is the article's title.
  • Assign that module to that one article (or menu item), in the banner position.
This is a manual work-around and I don't know if the above is how you can achieve what you want, but try it out. The article title is tied to the article, you can't move it to a module. You can (in the article options) not show the article title) and so you can have a separate module showing it. This would be no different than creating a banner/slideshow that you place in the banner module position on certain pages, except in your case, you want to do so for specific pages. It may not be a long-term solution if you have to do this with every article you have.

I don't know if there's any (easy) coding solution to achieve it.
Regards - A Murray
General Support Moderator

joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

Re: How can i call the "Article Title" via a module?

Post by joomlerGR » Sat Apr 20, 2024 9:40 pm

there is not any code that i can call the article title and display it inside a module?

joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

Re: How can i call the "Article Title" via a module?

Post by joomlerGR » Sat Apr 20, 2024 9:47 pm

on my old joomla website i was using the following code
inside the default.php to call-display the article title in other position of the page:

Code: Select all

        <h1 itemprop="nameer" style="font-size: 17px;letter-spacing: -0.4px;padding-top: 10px;padding-bottom: 8px;width: 848px;float: none;">
        <?php if ($params->get('show_title')) : ?>
		<?php if ($params->get('link_titles') && !empty($this->item->readmore_link)) : ?>
		<?php echo $this->escape($this->item->title); ?>
		<?php else : ?>
		<?php echo $this->escape($this->item->title); ?>
		<?php endif; ?>
		<?php endif; ?></h1> 

joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

Re: How can i call the "Article Title" via a module?

Post by joomlerGR » Wed Apr 24, 2024 9:37 pm

ANY UPDATE?

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2955
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: How can i call the "Article Title" via a module?

Post by SharkyKZ » Thu Apr 25, 2024 6:13 am

A similar question was asked on JSE https://joomla.stackexchange.com/a/33777/12652. If you need specifically article title, you'll need to query the article model or the database.

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1675
Joined: Tue Jun 30, 2020 12:17 pm

Re: How can i call the "Article Title" via a module?

Post by Pavel-ww » Thu Apr 25, 2024 8:53 am

joomlerGR wrote:
Sat Apr 20, 2024 7:57 pm
i want to display-call the current article title via module at the "banner" position because i will hide the current one:
<div class="page-header">
<h1 itemprop="headline">
ARTICLE TITLE </h1>
Hi. This will be a big mistake in the point of view of SEO. Perhaps you just need to use CSS to make the appearance as you want, but not to create Frankenstein hiding the structured H1

joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

Re: How can i call the "Article Title" via a module?

Post by joomlerGR » Thu Apr 25, 2024 5:17 pm

if i will use the following js to reposition the title i will have problems with SEO?

Code: Select all

<script defer>
    const pageHeaderElement = document.querySelector('.view-article .page-header');
    const modDatetimeElement = document.querySelector('.mod_datetime.mod_datetime_96');
    const parentElement = modDatetimeElement.parentNode;
    parentElement.insertBefore(pageHeaderElement, modDatetimeElement.nextSibling);
</script>

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1675
Joined: Tue Jun 30, 2020 12:17 pm

Re: How can i call the "Article Title" via a module?

Post by Pavel-ww » Fri Apr 26, 2024 6:55 am

joomlerGR wrote:
Thu Apr 25, 2024 5:17 pm
if i will use the following js to reposition the title i will have problems with SEO?
It doesn't matter which js you are using. Only the final HTML marking matters.

joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

Re: How can i call the "Article Title" via a module?

Post by joomlerGR » Fri Apr 26, 2024 1:34 pm

after i have the JS enabled and the article .page-header' <H1> position is changed to be shown before the <site-grid> when i use online tools to check the <H1> tag checker i get that result:
You do not have the required permissions to view the files attached to this post.

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1675
Joined: Tue Jun 30, 2020 12:17 pm

Re: How can i call the "Article Title" via a module?

Post by Pavel-ww » Sat Apr 27, 2024 7:07 am

joomlerGR wrote:
Fri Apr 26, 2024 1:34 pm
when i use online tools to check the <H1> tag checker i get that result:
Hi.

Online Tools checks the existence of H1, but does not check the correctness of its location in the aspect of the page semantic.

Imagine a book page with a text and heading. What you did - erased the heading from the page and wrote it on a separate sheet of paper.

Now the general elements of the site, such as breadcrumbs, sidebar, footer and others will be regarded by search engines as part of a specific page, which will cause warnings about duplication of content, too many keywords on the page and so on.

Therefore, your solution can be justified for a separate page such as Landing Page where you do not have common site's elements below H1. But not for all article page types.

I hope now you understand. But in any case, you decide. I do not insist, but just gave advice.

joomlerGR
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Fri Apr 05, 2024 1:13 am

Re: How can i call the "Article Title" via a module?

Post by joomlerGR » Sun Apr 28, 2024 10:52 pm

Pavel-ww wrote:
Sat Apr 27, 2024 7:07 am
joomlerGR wrote:
Fri Apr 26, 2024 1:34 pm
when i use online tools to check the <H1> tag checker i get that result:
Hi.

Online Tools checks the existence of H1, but does not check the correctness of its location in the aspect of the page semantic.

Imagine a book page with a text and heading. What you did - erased the heading from the page and wrote it on a separate sheet of paper.

Now the general elements of the site, such as breadcrumbs, sidebar, footer and others will be regarded by search engines as part of a specific page, which will cause warnings about duplication of content, too many keywords on the page and so on.

Therefore, your solution can be justified for a separate page such as Landing Page where you do not have common site's elements below H1. But not for all article page types.

I hope now you understand. But in any case, you decide. I do not insist, but just gave advice.
I get the point but the structure of the article page is only moved before the <div class="grid-child container-component">.

like this:

Code: Select all

<div class="page-header"><h1>..</h1>
<div class="grid-child container-component">...
Eve that a problem for SEO;

Is it posible to send me a message to show you my website and that part?


Post Reply

Return to “General Questions/New to Joomla! 5.x”