XML sitemap which includes tt_news articles - typo3

Currently I'm using mc_googlesitemap. I've read that I can include tt_news articles in the xml output when using "Google Sitemap for Contents". In the documentation you have an option Table where the contents live but this is not available for me. I only can choose "Google Sitemap for Contents" and than I have "Selected Pages". There are no such option as seen in the docu and as described here.
I'm using Typo3 4.7.10 and mc_googlesitemap 0.4.2.
I also tried weeaar_googlesitemap but here in the xml output I only see the page itself where the plugin was configured to display its output. Accessing Web -> GoogleSitemap doesn't work because of the deprecated function
Fatal error: Call to undefined method t3lib_div::fixed_lgd_pre() in
/usr/home/xxx/typo3conf/ext/weeaar_googlesitemap/mod1/index.php
on line 121
I found this fix but currently I cannot adapt the source files because I've no permissions.
How do I get an xml sitemap which can also display me tt_news articles of a certain category?
Edit:
I fixed the deprecated warning and my TS looks like the following (for the weaar sitemap):
#############################
# Sitemap
#############################
sitemap = PAGE
sitemap {
typeNum = 200
10 >
10 < plugin.tx_weeaargooglesitemap_pi1
10.pid_list = 1
10.recursive = 0
10.allowedDoktypes = 2,1,4
10.domain = http://www.domain.com/
10.tt_news.single_page {
1 = 78
1.pid_list = 77
}
10.tt_news {
disabledParameter = day,month,year
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:text/xml
no_cache = 1
xhtml_cleaning = 0
}
}
I have the following problems:
Hidden Pages are shown in my sitemap.xml (there is no page with doktype 5 allowed)
tt_news articles are not displayed (what is wrong with my configuration?)
Explanation:
10.pid_list = 1 // this is my main entry point
10.tt_news.single_page.1 = 78 // this is my page id where the single view of tt_news resides
10.tt_news.single_page.1.pid_list = 77 // this is my sysfolder where the news are placed
What I'm doing wrong? Alternatives?

There is an extension called tq_seo which does all the SEO magic for your TYPO3 site. It's quite easy but also powerful.

Related

How to prevent TYPO3 to render head- and body-elements when outputting JSON?

In TYPO3 8.7 I'm trying to generate JSON using FLUID.
I've created a page with dummy content and I've updated my TypoScript configuration for all pages in a folder.
TypoScript setup
[PIDinRootline = 10]
page = PAGE
page {
typeNum = 0
config {
disableAllHeaderCode = 1
disablePrefixComment = 1
xhtml_cleaning = none
admPanel = 0
debug = 0
metaCharset = utf-8
additionalHeaders = Content-Type:text/json;charset=utf-8
}
}
[global]
I created a dummy JSON file as well, to test the output, before creating the actual content using FLUID:
api.json
{
"hello": "world"
}
Now, this seems to work fine. But the output still includes the html- and body-elements.
Rendered output:
<html>
<head></head>
<body>
{"hello": "world"}
</body>
</html>
The documentations says:
If you want to output JSON, RSS or similar data with Fluid,
you have to write the appropriate TypoScript which passes the
page rendering to Extbase and Fluid respectively. Otherwise,
TYPO3 will always generate the <head>- and <body>-section.
But I don't know what to do here actually. How can I get TYPO3 to not render the wrapping HTML-elements?
The problem was a new syntax in TYPO3 8 and newer. In newer versions, the additionalHeaders is no longer just a TEXT but an array with numeric indices. So to set the correct header type, you have to use this one:
additionalHeaders.10.header = Content-Type:application/json;charset=utf-8
When you override the page object, you should remove all inside it before with page >.
Additionally Fluid is a templating engine for HTML, I don't know if that fits for JSON output.
Better way:
I'd suggest to use a separate object than page and a different page type:
[globalVar = GP:type = 133]
jsonOutput = PAGE
jsonOutput {
typeNum = 133
config {
...
}
}
[global]
What you are missing is this typoscript:
config.disableAllHeaderCode = 1
read the manual
as you want it on a special page you can use a special typoscript template for this page. For a pagetype it is a little more complicated as this configuration would work on all pagetypes.
if you want some config options only for a special pagetype you can add this config to the pagetype only like this:
json = PAGE
json.config.disableAllHeaderCode = 1
Be aware that fluid is more complicated if you output other structure than HTML. But it is possible! Have a special look on whitespace and braces ({})

RealURL with GET parameters

We have developed a typo3 plug in that searches for trucks. For SEO reasons, we are trying to use the realURL plug in to make the URLs friendlier to use.
On the front page we have several call to actions that link to the search page with certain search parameters. An example is bellow:
/search-results/?tx_fds_searchresults[type_name]=Trailer
This link works as expected. On the results page is a link to the listings page with more details. An example is bellow:
/listing/?tx_fds_listing[id]=119870
This link is not working. tx_fds_listing[id] is not being populated in the arguments passed to the plug in controller.
At first we thought it might be a config issue but again, it isn't present on other pages.
The ID is not a database object and may be a text string instead.
Edit:
I should add that it works fine with RealURL turned off.
We get the id as $id = $this->request->getArgument('id');
Edit 2:
Here is the error message from the logs.
[ALERT] request="28233e225150a" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! Code: 201512141630381db91bba - {"exception":"exception 'TYPO3\\CMS\\Extbase\\Mvc\\Exception\\NoSuchArgumentException' with message 'An argument \"id\" does not exist for this request.'
I also tried renaming the variable to name, but that didn't work either.
I have a solution that solves the root cause of the problem, if not the specific issue.
So I had to add additional mapping to the realurl_conf.php file. For example to get the listing id:
$config['domain.com']['postVarSets'][3]['stock'] = array(array('GETvar' => 'tx_fds_listing[id]'));
This makes the effective URL:
/listing/stock/119870
This was the intended usage for the plugin, so this is a good result. I also added configuration for ajax and pdfs. This required modification to the typoscript that was not obvious.
PDF TS:
pdf = PAGE
pdf {
typeNum = 300
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
#vendorName = TYPO3
extensionName = Fds
pluginName = Listing
#controller = FDS
controller = Tx_Fds_Controller_FDSController
#action = listingPdf
switchableControllerActions.FDS.1 = listingPdf
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/pdf
xhtml_cleaning = 0
admPanel = 0
}
}
PDF RealURL Config:
$config['domain.com']['postVarSets'][3]['pdf'] = array('type' => 'single', 'keyValues' => array ('type' => 300));
PDF effective URL:
/listing/pdf/stock/119870

typolink: set page type for internal links on condition

how can i create a typolink which:
reads it's target from a column in tt_content (like header_link f.e.)
applies a page type to internal links, but obviously not to external links
f.e., given the values 42 and https://x.org in header_link the desired links should look like:
/<path_to_page_id 42>?type=5
https://x.org
i can't figure out how to apply the page type on the condition internal/external link. this is what i got:
text = TEXT
text.value = click here ;-)
text.stdWrap.typolink {
parameter.field = header_link
# following line should only apply if `header_link` is an internal link
parameter.wrap = |,5
}
edit to clarify:
above code produces:
/<path_to_page_id 42>?type=5
https://x.org,5 <-- not what i want
how do i get the page type for internal links and leave external links untouched?
Documentation to the TSREF for typolink
http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html
adding a page type:
lib.sampleLink = TEXT
lib.sampleLink.value = Open Page 25 with Type 800 in a new window
lib.sampleLink.typolink.parameter = 25,800 _blank

Typoscript: Display register value as text

I'm using the extension seo_dynamic_tag, which is a fantastic plugin for TYPO3 SEO purposes.
It uses registers to store the generated meta description and keywords. Later on in the script, the page metadata is filled in from these registers:
page {
meta {
description {
field >
data = register:description
}
keywords {
field >
data = register:keywordss
}
}
1000 < temp.seo
}
So far it works like charm.
But in addition I'd like to display a TEXT object on the page with the meta description on the bottom. The text should read the meta description and some other stuff. That's where I need your help.
I tried to do the "magic" like this:
temp.description = COA
temp.description {
10 = TEXT
10.value = Meta description: {register:description}
stdWrap.insertData = 1
}
lib.footer < temp.description
This simply does not work. If I want to display something else, for example {page:title} or {date:y-m-d}, data insertion works. For register:xxx it doesn't.
I already spent lots of hours to google out my desired solution, but no success :(
Do you have any idea what I'm missing here?
I'm using TYPO3 4.5.3 (I know I should update ;)).
Many thanks in advance for your help! :)
Your stdWrap.insertData = 1 is applied to your COA-object, and not to your TEXT-object. You can instead set 10.insertData = 1 or just write the following:
10 = TEXT
10.data = register:description

TYPO3 / TypoScript: How to make a fallback?

I want to output a string to the rendered HTML by using two fallbacks.
My typoscript is defined at the top level page (root page of my website) and is passed to all pages at lower levels.
Structure:
Homepage
Page at level 1
Page at level 2
Regular output of the file:
The string comes from a TemplaVoila field (Page / Edit / Extended / MyField): field_copyright_name
To output it to the desired point in the HTML output a templaVoila mapping exists (Type: Typoscript Object Path), named: lib.copyright_name
The following typoscript does the job:
lib.hint_copyright_name = COA
lib.hint_copyright_name.10 = TEXT
lib.hint_copyright_name.10 {
setCurrent.dataWrap = {field:field_copyright_name}
current = 1
}
This works for all pages at all levels where the field (in page properties) is not empty.
The first fallback:
If the field is empty (in properties of that page, e.g. at level 2) typoscript should get the value from the pages above (at level 1, and if it is empty too, it should get it from homepage). No clue how to do it. Can you help?
The second fallback
If the first fallback still returns an empty string (because the field was empty at all levels) it should do a fallback to a default value "Copyright by me".
To enable this fallback without "first fallback" is easy:
switchdefault_copyright_name = TEXT
switchdefault_copyright_name {
setCurrent.dataWrap = {field:field_copyright_name}
current = 1
override = "Copyright by me"
override.if.isFalse.field = field_copyright_name
}
lib.hint_copyright_name = COA
lib.hint_copyright_name.10 < switchdefault_copyright_name
But how to integrate the "first fallback"?
EDIT:
I tried:
setCurrent.data = {levelfield:-1, field_copyright_name, slide}
or
setCurrent.data = levelfield:-1, field_copyright_name, slide
or
setCurrent.dataWrap = {levelfield:-1, field_copyright_name, slide}
or
setCurrent.dataWrap = levelfield:-1, field_copyright_name, slide
but without success - no output.
Just found this : http://lists.typo3.org/pipermail/typo3-english/2006-October/032764.html
It's supposed to make youre slide thing to work.
Just set : Installation > all configuration > addRootLineFields
Didn't tried it, but seems like the solution