Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEO for pagination of news, tags and categories: H1 and so on #2167

Open
aksenovaa opened this issue Jul 25, 2023 · 0 comments
Open

SEO for pagination of news, tags and categories: H1 and so on #2167

aksenovaa opened this issue Jul 25, 2023 · 0 comments

Comments

@aksenovaa
Copy link

For search engine optimisation, it is advisable to change the title, description and h1 on each page of a list of, for example, news.
For this purpose it is sufficient to add e.g. page 2 at the end.
How can this be done in the pagination of the news list on the site? All meta descriptions can be made different on all pagination pages. But for H1 I haven't found a solution.

Below I will describe what I have done.

On my sites on the news list page, I make a tag list element at the top. And there already change the title and description. For example, for this site https://art-poligrafy.ru/portfolio/. In .../Resources/Private/News/Templates/News/List.html for listing news and tags (Thus all meta descriptions can be made different on all pagination pages):

...
	<f:if condition="{overwriteDemand.tags}">
		<f:then>
			<f:for each="{tags}" as="tag">
				<f:if condition="{tag.uid} == {overwriteDemand.tags}">
					<f:if condition="{tag.seotitle}">
						<n:titleTag>
							<f:format.htmlentitiesDecode>{tag.seotitle}{f:if(condition: '{pagination.currentPage} > 1', then: ' &#128463;&nbsp;{pagination.currentPage}')}</f:format.htmlentitiesDecode>
						</n:titleTag>
						<n:metaTag property="og:title" content="{tag.seotitle -> f:format.stripTags()}{f:if(condition: '{pagination.currentPage} > 1', then: ' страница {pagination.currentPage}')}" />
					</f:if>
					<f:if condition="{tag.seodescription}">
						<n:metaTag name="description" content="{tag.seodescription -> f:format.stripTags()}{f:if(condition: '{pagination.currentPage} > 1', then: ' &#128463;&nbsp;{pagination.currentPage}')}" />
						<n:metaTag property="og:description" content="{tag.seodescription -> f:format.stripTags()}{f:if(condition: '{pagination.currentPage} > 1', then: ' страница {pagination.currentPage}')}" />
					</f:if>
					<f:render partial="List/Schema" arguments="{_all}"/>
				</f:if>
			</f:for>
		</f:then>
		<f:else>
			<f:if condition="{pagination.currentPage} > 1">
				<n:titleTag>{pageData.seo_title} {f:if(condition: '{pagination.currentPage} > 1', then: '&#128463;&nbsp;{pagination.currentPage}')}</n:titleTag>
				<n:metaTag property="og:title" content="{pageData.seo_title -> f:format.stripTags()}{f:if(condition: '{pagination.currentPage} > 1', then: ' страница {pagination.currentPage}')}" />
				<n:metaTag name="description" content="{pageData.description}{f:if(condition: '{pagination.currentPage} > 1', then: ' &#128463;&nbsp;{pagination.currentPage}')}" />
				<n:metaTag property="og:description" content="{pageData.description -> f:format.stripTags()}{f:if(condition: '{pagination.currentPage} > 1', then: ' страница {pagination.currentPage}')}" />
			</f:if>
		</f:else>
	</f:if>
...

But how to diversify H1 on pagination pages? I put at the top of the page to display a list of tags (filtering the list of news). And in the template I output H1. But pagination status information is not available in the template for the tag list. And thus, I can't add anything by page number condition. H1 and text on pages I did in ....../Resources/Private/News/Templates/Tag/List.html:

<f:if condition="{tags}">
		<f:if condition="{overwriteDemand.tags}">
			<f:else>
				<div class="frame frame-size-default frame-default frame-type-header frame-layout-embedded frame-background-secondary frame-no-backgroundimage frame-space-before-none frame-space-after-none"><div class="frame-group-container"><div class="frame-group-inner"><div class="frame-container frame-container-default"><div class="frame-inner"><header class="frame-header"><h1 class="element-header text-center"><span>Портфолио типографии «Арт&nbsp;полиграфия»</span></h1></header></div></div></div></div></div>
				<header class="frame-header">
					<h2 class="element-subheader tag-header">
						<small class="text-muted">{data.description -> f:format.stripTags()}Широкоформатная, интерьерная, офсетная, цифровая печать.</small>
					</h2>
				</header>
			</f:else>
		</f:if>
		<f:for each="{tags}" as="tag">
			<f:if condition="{tag.uid} == {overwriteDemand.tags}">
				<div class="frame frame-size-default frame-default frame-type-header frame-layout-embedded frame-background-secondary frame-no-backgroundimage frame-space-before-none frame-space-after-none"><div class="frame-group-container"><div class="frame-group-inner"><div class="frame-container frame-container-default"><div class="frame-inner"><header class="frame-header"><h1 class="element-header text-center"><span>						<f:if condition="{tag.seoheadline}">
							<f:then>
								<f:format.stripTags>{tag.seoheadline}</f:format.stripTags>
							</f:then>
							<f:else>
								<f:format.stripTags>Портфолио типографии «Арт&nbsp;полиграфия»</f:format.stripTags>
							</f:else>
						</f:if></span></h1></header></div></div></div></div></div>
				<header class="frame-header">
						<f:if condition="{tag.seodescription}">
							<h2 class="element-subheader tag-header">
								<small class="text-muted">{tag.seodescription -> f:format.stripTags()}</small>
							</h2>
						</f:if>
				</header>
			</f:if>
		</f:for>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant