TYPO3 meta description - Use closest - typo3

I have set the description meta using:
page.meta.description.field = description
Can I make it so child pages use the description from the closest page that has one set?
So if the root page has description1 then all sub-pages use it, unless a sub-page has it's own description2 in which case it and any sub-pages of it would use description2 and so on...

two parts:
in your typoscript:
page.meta.description.data = levelfield:-1, description, slide
in your Install-Tool add the field to the fields which should slide:
$GLOBALS['TYPO3_CONV_VARS']['FE']['addRootLineFields'] = 'description';
added:
aside from straight slide to first non empty entry, you also have options to collect all the entries along the rootpath:
.slide If set and no content element is found by the select command, the rootLine will be traversed back until some content is found.
Possible values are "-1" (slide back up to the siteroot), "1" (only the current level) and "2" (up from one level back). Use -1 in combination with collect:
.slide.collect: (integer /stdWrap) If set, all content elements found on the current and parent pages will be collected. Otherwise, the sliding would stop after the first hit. Set this value to the amount of levels to collect on, or use "-1" to collect up to the siteroot.
.slide.collectFuzzy: (boolean /stdWrap) Only useful in collect mode. If no content elements have been found for the specified depth in collect mode, traverse further until at least one match has occurred.
.slide.collectReverse: (boolean /stdWrap) Reverse order of elements in collect mode. If set, elements of the current page will be at the bottom.

You should not do this - you will get a bunch of error messages in the google webmaster tool complaining about duplicate meta tags. Google dont like this ... it is a kind of duplicate content.
Watch this video from google evangalist Matt Cutts: http://searchengineland.com/googles-matt-cutts-dont-duplicate-your-meta-descriptions-177706
"In short, it is better to let Google auto-create snippets for your pages versus having duplicate meta descriptions."

Related

EPi find get all variants if search hit on product

A EPi find question coming up, We have WebProducts and WebVariants and when showing a simple product listing on the category page I'm showing the following result correctly
If a WebProduct doesn't have any variants - show the WebProduct on the result
If a WebProduct has variants - show the WebVariants and hide the WebProduct
But when I'm trying to use the same functionality for the site-search it gets complicated.
The WebProduct has a property named Brand while the WebVariants doesn't have that property. So when I search for "My brand" and I get a hit on a WebProduct that has WebVariants, it won't show the WebProduct because point 2 is true in that case.
I on the other hand don't want to show the product, but I want to get the variants for that product... It might sound confusing :grimacing:
I'll add a code snippet of the code that makes point 1 and 2 to work.
.SearchAndFilterFor(q)
.Filter(x =>
(x.MatchType(typeof(WebVariant))) |
(x.MatchType(typeof(WebProduct)) & ((WebProduct)x).HasVariants().Match(false)))```
I would say that you have a couple of options to choose from.
Either:
1: Change the way your variants are indexed so that they include some of the key info (in this case brand) that they currently lack and as such, appear in the search results.
OR
2: Just do the search for WebProduct and then loop through those results afterward to do the processing for ones that do/don't have variants.

wrong content elements in translation of tx_news

TYPO3 8.7, tx_news 7.2 or 7.3.1.
I use tx_news with attached content elements. In default language all work fine, but when i translate the news article i get a single wrong content element in the list of translated content elements, always on first place.
In steps:
- translating news article
- alle depending content elements are correctly translated
- on first place there is a foreign - translated - content element which does not belong to the news but to a total different page in the tree.
- when i translate the next news article the same content element ist now connected to the new translation - and so on.
- when i click on "Synchronize with default language" the wrong content element is deleted! (Which is wrong and should not happen, of course!)
In the database the wrong content element gets for every translation a new entry in the field "tx_news_related_news. It shuffles from news article to news article ... In the end i get an element which is connected with the news entry which was translated last.
When i delete this content element (or click on "Synchronize with default language" which results in the same) a new false content element is used and begin to shuffle from article to article.
Any ideas what`s going on? Or how to fix it?
Peter

Is it allowed to use <label> tag without labeled control?

I need to show in a page a list of, let's say, person's properties that should be rendered more or less as follow:
name: Name
date: 1/1/2000
other: Other
Reading the doc they say:
The LABEL element may be used to attach information to controls.
So, is it the right tag to encompass the names of the properties like name, date...
even if there's not an <input> to associate with?
Nope, as per Quentin’s answer.
However, in HTML5, <dl> can be used for generic associations where <label> isn’t appropriate.
No.
It says that it can associate information with controls.
It does not say that it can associate information with anything else.
See also the newer (but draft) specification:
Some elements, not all of them form-associated, are categorized as
labelable elements. These are elements that can be associated with a
label element.
button input (if the type attribute is not in the hidden state) keygen
meter output progress select textarea
No, it is not correct to use the label element like that.
The important thing here is the meaning of may.
The LABEL element may be used to attach information to controls.
RFC 2119 (which the HTML4 spec follows) defines may:
May: This word, or the adjective "OPTIONAL", mean that an item is truly optional
So here, may does not mean the label element can be used for other purposes; it just means that it is not required to use a label element with controls.
As far as alternatives go, it depends what you want to achieve. If you are just trying to follow the spec closely, then I suggest using p and a strong element for each pair. If you want the data to be more meaningful to computers, you could consider using one of the Microformat specifications.
I partially agree with the answers so far but want to add that if you want to use labels for some reason, then I would display the property values in read-only controls, and then your labels will be valid.
I've done this using appropriate styling to differentiate the read-only controls from the functioning controls to avoid confusing your users. This was on a sequence of pages which built up the information gathered from the user in a wizard.
I have this link to W3C - the "Editor's Draft" as opposed to the link above which is the "Working Draft", which states that you can associate it with any element - as long as it's 'labelable' - even though this is a subsection of the Form section. It states earlier that a labelable element does not have to be within a form.
http://dev.w3.org/html5/spec/single-page.html#the-label-element

Are there ways to work around the limitations of the Open Graph action story attachment caption template?

There are 3 specific limitations of open graph action attachment captions that I'm trying to work around. I'm referring to the attachment caption that is configurable in the Action configuration page (e.g. https://developers.facebook.com/apps/<app-id>/opengraph/action_type/<action-type-id>).
I can't find a way to insert newlines or line breaks. I'm guessing this is probably by design, but it seems like a reasonable thing to be able to do.
If the action can be applied to more than one object type, you can't use fields from either object in the caption template. If you do, the caption "breaks" (displays incorrectly) when you reference a field from an object that is unset.
For example, action "drive" could be associated with "car" or "truck". If the caption is {car.model}, then it breaks for trucks. Related to this post. Ideally I'd like to be able to do something like ({car.model} OR {truck.make}).
Optional action/object fields can't be used in the caption, because if they're ever unset, the caption "breaks" just as in #2 above.
When I say the caption "breaks," I mean that it displays incorrectly. It seems to go into a debug mode where it displays fieldName fieldValue pairs for various fields from the object/action.
Are there any workarounds for these 3 issues?
Note that I'm not dealing with aggregations, just the actual action Open Graph post.
UPDATE: It looks like Facebook just pushed a change within the last day to allow multiple lines of caption. That solves item #1. Item #2 and #3 are still outstanding.
UPDATE 2: For #2, if you only put a single template item per-line (e.g. {someobject.somefield}), it seems to work OK. If that option is unset, that line doesn't display. However, if you put more than one field, it seems to resort to the "breaking" behavior. This might also work for #3, haven't tried yet.
As stated in the updates above:
Facebook made a change to allow multiple lines of caption. That solves item #1 directly, and items #2 & 3 indirectly...
For #2 & #3, if you only put a single template item per-line (e.g. {someobject.somefield}), it seems to work OK. If that option is unset, that line doesn't display. However, if you put more than one field, it seems to resort to the "breaking" behavior. This might also work for #3, haven't tried yet.

Customizing single entry templates in ExpressionEngine (1.6.x)

This is either very annoying or very embarrassing. I've set up most of my blog, but I can't figure out where or how the heck I set up single entry templates as opposed to the section/weblog containing them. I just can't find information on how to do it for the life of me.
This is especially important, because I want to define the canonical link for all entries, since ExpressionEngine links to entries in all kinds of ways.
So, the case is that I have a Blog section/weblog with an index working as the front page for mydomain.com. This lists all my entries as you would imagine a regular blog to do. The problem arises when I need to customize the code for the single entries' links.
If you have a template set up already which is showing a multitude of entries and you want a single entry page for each entry then what you need to do is this :
{exp:channel:entries
channel="default_site"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
Then in the template shown above by template_group/template_name (please change those to whatever your template group and template names actually are ;-) ) you will place this code :
{exp:channel:entries
channel="default_site"
limit="1"
dynamic="yes"
sort="asc"
disable="member_data|pagination|categories"}
{title}
{/exp:channel:entries}
This will then show you just the one entry as you will have used the {url_title_path="template_group/template_name"} in the first channel entries tag above which would basically create a URI something like this :
http://www.example.com/template_group/template_name/url_title_of_my_posted_entry
On the second (template_group/template_name) single entry template page it will see the URL title and use this to filter down the channel entries tag to just that one entry.
Hope that helps a bit.
Best wishes,