TYPO3 v10.5 find all pages of site in backend - command

I'm currently working on a scheduler task to render a XML feed of all pages of a TYPO3 site and save this feed as a file.
Therefore I need all pages of this site, so all sub pages of one root page.
Any ideas how to do this without the usage of the TSFE (TypoScript Frontend Controller)? I would like to avoid the initialization of the TSFE in backend context. Or is there a good way to do this in TYPO3 v10.4?

You can use \TYPO3\CMS\Core\Database\QueryGenerator::getTreeList($id, $depth) to fetch all pages recursive for the given page uid and depth. This returns a list of all descendant page uids, which you later can use to fetch all page records.

Related

TYPO3 v9 pages accessible through URL like /page/<pageId>/

How can I do with the new Routing API to make pages accessible through something like https://example.com/page/{idOfThePage}? Normal slug behavior with page title still needs to work.
Thanks
The easiest solution would be to just adapt the page slugs in the page properties. For many pages you can do that in the DB (field pages.slug).
If you want new pages and the slug autogeneration in the backend to follow that, too you can overwrite EXT:cores pages TCA in your TCA/Overrides/pages.php (docs TCA type slug).
I suggest (not tested):
$GLOBALS['TCA']['pages']['columns']['slug']['config']['generatorOptions']['fields'] = ['uid'];
$GLOBALS['TCA']['pages']['columns']['slug']['config']['generatorOptions']['prefixParentPageSlug'] = false;
I have no idea how to get the base /page in there. You could set your site's base path to /page in site config maybe? Or you might need a generatorOptions[postModifier].
Notice:
A routeEnhancer might come to mind first for rewriting URLs. And yes, for other simple parameters a SimpleEnhancer is able to do that - yet for the base path/pageUid it is not.

Blog-like single element pages with TYPO3 / TemplaVoila

I have a blog-like part of an page using TYPO3 / TemplaVoila. There are articles that should show up summarized on a single page, but have their own pages / URLs each one too.
However, having the editors add a page AND a flexible content element for each entry is complicated.
So is it possible by some typoscript to have a page, showing a single content element from some other page, sporting a proper URL without having to setup an extra page for each element?
What you want is doable without TV and with other records than tt_content.
e.g.: ext:news does it: the content are news records, which are shown with plugins in list- and detail-mode.
Of course you can reinvent the complete logic of such an extension so you can do it with tt_content records, which could be stored in the usual way scattered on multiple pages.
But the logic is clearer if there only is one page (or very few pages which represent some categorization) where special records are stored.
Plugins would be configured to show only selected records (from one category, which are marked top, which are current, ...) and you have one page (one for all and not for each news one) where the records are shown in detail.
Also each has it's own URL, either with URL-parameter (by default) or you configure realurl (or similar) to build a "real url" from news title (and uid).

News Component Requirement

We have a requirement to create a News Component. So there will be news pages which we will author contains Title, Image & description. I will store this under one node say content\myproject\newsnode\news1,news2 like this.
On the homepage, I want to show the latest 3 authored news description. For that, I'm thinking of using a news component.
I thought of creating 2 component and map them. Thinking of using the Query builder to fetch the latest news to show on homepage. One component of news page and one component on a homepage to show latest 3 news with Title, Tile image and a small description.
Is there any other approach to this?
If you are using a dispatcher, querybuilder servlet is blocked by default and should be blocked for obvious reasons.
Since your question is general, I will try to answer generally and on a high level.
There are two possible options I can think of:
1. make a servlet to retrieve the last 3 news component information and expose them as JSON. Then send an AJAX request from your browser and change the view accordingly with jquery or your front-end framework of choice.
Advantages: No caching, you'll always get the latest news.
Disadvantages: SEO, if you care about that in this case. Search engines will
not index the news on the page since they are not part of the initial markup (not server-side rendered)
2. Create a service to get the last 3 news component info then render them on your component via HTL or JSP. Basically server-side render them.
Advantages: SEO, same as the reason above.
Disadvantages: You have to invalidate the cache for your page every time a new news component is added to make sure your end users get the latest.
Hope this helps.

tx_news direct link to news entry

it is possible to have a direct path to a special news entry?
example:
my link is: http://www.domain.de/start/topnewsdetail/news/really-long-name-of-news-entry.html
and it would be nice to have
http://www.domain.de/newsEntry.html.
Can someone give a hint?
it is a little bit complicated if you want a general automatic solution.
you can do it by hand if you insert pages of type 'external url' where you insert the long path as external url.
with realurl you have problems as realurl at least will use one path segment for the page with the detail view before the last segment which is for identifying the news record. AFAIK coolurl can ommit the path segemnt for the page.
on the other hand: make sure the news identification (title, subtitle?) is unique and does not collide with pathes for normal pages.
at last you can use .htaccess rewrites, but that needs to differentiate between short urls for news and short urls for top-level pages. So those urls will show the page, those urls are not generated inside of TYPO3 and so nowhere used (except manual)
this EXT. adds a custom link to records like system category or news:
https://typo3.org/extensions/repository/view/recordlink
It'S deployed for TYPO3 6.2 but perhabs it'S helpful to create an own EXT.?

How to manipulate the meta area of the HTML dom with Scala-JS for a single page application

General Scala-JS page building advice needed. Most of the examples seem to be of the pattern where the main into which your single page application will go is between the tags in a landing page html file. How do you handle the need to insert something in the meta area of the dom? Do I need to render my landing page dynamically from the server to accomplish this? My specific need is to inject a script tag into the meta area of an already defined static html page. I'm using scalajs-react.
Generally you will want a server-rendered "root page" for the SPA. This allows you to dynamically compute proper cache busting file names for your script and stylesheet tags and to easily manage the cache expiration of the root page. Also, for proper html5 push state support you'll want to serve that page at every URL, which is easily done with a server side route.