t3 / file-canonical
Canonical links for files, in TYPO3 CMS.
Installs: 249
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:typo3-cms-extension
Requires
- php: >=7.4
- typo3/cms-core: ^10.4 || ^11.0
Requires (Dev)
- armin/editorconfig-cli: ^1.1
- friendsofphp/php-cs-fixer: ^2.18
- jangregor/phpstan-prophecy: ^0.8
- phpstan/phpstan: ^0.12.80
- saschaegerer/phpstan-typo3: ^0.13
- typo3/minimal: ^10.4
Replaces
- typo3-ter/file_canonical: *
This package is auto-updated.
Last update: 2021-04-21 18:57:54 UTC
README
This is an extension for TYPO3 CMS. It provides canonical links for files.
Screenshots
Screenshot 1: Extended sys_file_metadata TCA
Screenshot 2: Additional HTTP response header "link"
Screenshot 3: Info module overview
Installation
Download
composer req t3/file-canonical
Or fetch from TER.
Setup
After you've fetched and installed the file_canonical extension, like any other TYPO3 CMS extension, you need to adjust the configuration of your webserver.
Usually TYPO3 does not process files which are actually existing.
For Apache, you need to add the following contents to .htaccess file, right after the TYPO3_CONTEXT
has been set:
# Rule for EXT:file_canonical RewriteCond %{REQUEST_URI} ^/fileadmin RewriteCond %{REQUEST_FILENAME} \.(pdf|docx|xlsx|pptx)$ RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
Now, all requests which point to /fileadmin
and request a PDF or common office file, will be processed
by the FileCanonicalMiddleware
provided by this extension.
Extension settings
Usage
To enable canonical link for a file:
- Edit the file's metadata, in TYPO3 backend (see screenshot 1)
- Set a page or record, on which this file is located at
- After saving metadata, the canonical link get parsed and stored to database
Now, when requesting the file in Frontend, will add additional "Link" HTTP header (see screenshot 2).
Auto Canonical Link
The extension creates the canonical link automatically from HTTP referer, if enabled. (see Extension settings)
Roadmap
- Add translations for locallang
- Provide RST documentation
- Publish in TER and on Packagist