承接 hyperdigital/hd_structureddata 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hyperdigital/hd_structureddata

Composer 安装命令:

composer require hyperdigital/hd_structureddata

包简介

Extension for adding structured JSON-LD into page headers

README 文档

README

TYPO3 extension for handling Google structured data into your page.

Initialization

  • install the extension
  • include static typoscript file (HD Structured data)
  • go to edit page properties
  • open tab "Structured data"
  • add a new structured data item

Existing structured data

Article

Source: https://developers.google.com/search/docs/appearance/structured-data/article

Course

Source: https://developers.google.com/search/docs/appearance/structured-data/course-info

FAQ

Source: https://developers.google.com/search/docs/appearance/structured-data/faqpage

Organization

Source: https://developers.google.com/search/docs/appearance/structured-data/organization

Job Posting

Source: https://developers.google.com/search/docs/appearance/structured-data/job-posting

Video

Source: https://developers.google.com/search/docs/appearance/structured-data/video

Review

Source: https://developers.google.com/search/docs/appearance/structured-data/review-snippet

Products

Source: https://developers.google.com/search/docs/appearance/structured-data/product

Events

Source: https://developers.google.com/search/docs/appearance/structured-data/event

Possibility to attach already used Organization as organizer

Events should contain organizer. It's possible to attach already exiting organization over field "Pointer to already existing organizers" where is possible to choose different structured data entries, but only Organization type would be used in Frontend output.

Image

Source: https://developers.google.com/search/docs/appearance/structured-data/image-license-metadata

After installing this extension, a new ViewHelper with empty output is available for use in your Fluid templates: {f:imageStructuredData(image: image, uri: 'https:\\www.web.com\fileadmin\img.jpg')}. This ViewHelper integrates structured data for images across your TYPO3 website. The image parameter is used to pass the image object. If you need to provide an alternative URL instead of publicUrl, use the uri parameter (of type string).

Usage

To use the imageStructuredData ViewHelper, include it in your Fluid templates as follows:

<f:image image="{image}" ...  />
<f:imageStructuredData image="{image}" />

After installing this extension, a new ViewHelper with empty output is available for use in your Fluid templates: {f:imageStructuredData(image: image, uri: 'https:\\www.web.com\fileadmin\img.jpg')}. This ViewHelper integrates structured data for images across your TYPO3 website. The image parameter is used to pass the image object. If you need to provide an alternative URL instead of publicUrl, use the uri parameter (of type string).

Available image sources are:

  • FileReference
  • File
  • Array where id is combined identifier ($image['id'] = '1:/foo.txt';)
  • String like file typolink t3://file?uid=12345

Sitelinks search box

Source: https://developers.google.com/search/docs/appearance/structured-data/sitelinks-searchbox

Integration of searchbar inside the search results.

This data should be included only on homepage.

Search parameter (search_parameter)

Extension URL
Indexed search (indexed_search) tx_indexedsearch_pi2%5Baction%5D=search&tx_indexedsearch_pi2[search][sword]=###SWORD###&no_cache=1
Faceted Search (ke_search) tx_kesearch_pi1[sword]=###SWORD###&no_cache=1

Possibility to use it on detail pages (news, products, etc.)

First add a field into database and TCA

ext_tables.sql

CREATE TABLE tx_news_domain_model_news (
    structured_data INT(11) DEFAULT 0 NOT NULL,
);

Configuration/TCA/Overrides/tx_news_domain_model_news.php

$tempColumns = [
    'structured_data' => [
        'label' => 'Structured data',
        'config' => [
            'type' => 'inline',
            'foreign_table' => 'tx_hdstructureddata_domain_model_structureddata',
            'foreign_field' => 'foreign_uid',
            'foreign_sortby' => 'sorting',
            'foreign_table_field' => 'tablename',
            'foreign_match_fields' => [
                'fieldname' => 'structured_data',
            ],
            'behaviour' => [
                'allowLanguageSynchronization' => true
            ],
        ],
    ]
];

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns("tx_news_domain_model_news", $tempColumns, 1);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
    'tx_news_domain_model_news',
    '--div--;Structured Data, structured_data',
);

Then integrate the typoscript code.

TypoScript

[request && traverse(request.getQueryParams(), 'tx_news_pi1/news') > 0]
    # this part is not needed if default typoscript is used
    # page.headerData.90 = USER
    # page.headerData.90.userFunc = Hyperdigital\HdStructureddata\UserFunctions\StructuredDataPrint->printTags
    page.headerData.90 {
        tableName = tx_news_domain_model_news
        fieldName = structured_data
        parentUid = GP:tx_news_pi1|news
    }
[end]

Possibility to use it on listing pages (news, products, etc.)

This needs template adaption. You can use fluid viewhelper for append the structured data for a specific table, like in the deail pages above.

The viewhelper has 2 possible ways:

Using parent object

<f:generateStructuredData tablename="tx_news_domain_model_news" fieldname="structured_data" object="{newsItem}" />

Using row uid, but here be careful and use the in the translations the uid of the translated row instead of the default language.

<f:generateStructuredData tablename="tx_news_domain_model_news" fieldname="structured_data" parentUid="{newsItem.uid}" />

Or there is also a possibility to use the data directly over controller:

 $dataService = GeneralUtility::makeInstance(GenerateDataService::class);
 $dataService->generateDataFromObject('tx_news_domain_model_news', 'structured_data', $newsItem);

 //Or for the specific UID
 $dataService->generateDataFromUid('tx_news_domain_model_news', 'structured_data', $newsItem->getUid());

hyperdigital/hd_structureddata 适用场景与选型建议

hyperdigital/hd_structureddata 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.41k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 hyperdigital/hd_structureddata 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 hyperdigital/hd_structureddata 我们能提供哪些服务?
定制开发 / 二次开发

基于 hyperdigital/hd_structureddata 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4.41k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2024-02-02