Skip to content

Commit

Permalink
Merge pull request #8 from tarosky/feature/noindex-attachment
Browse files Browse the repository at this point in the history
Feature/noindex attachment
  • Loading branch information
fumikito authored Jul 29, 2024
2 parents 22fb7c4 + 354c99e commit 6710efd
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 50 deletions.
5 changes: 4 additions & 1 deletion .wp-env.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"plugins": [ "." ],
"plugins": [
".",
"https://github.com/kuno1/virtual-member/releases/latest/download/virtual-member.zip"
],
"themes": [
"https://downloads.wordpress.org/theme/twentytwenty.latest-stable.zip",
"https://downloads.wordpress.org/theme/stacks.latest-stable.zip"
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.0",
"wp-coding-standards/wpcs": "^3.0"
"wp-coding-standards/wpcs": "^3.0",
"kunoichi/virtual-member": "^1.2"
},
"autoload": {
"psr-0": {
Expand Down
Binary file modified languages/tsmap-ja.mo
Binary file not shown.
78 changes: 61 additions & 17 deletions languages/tsmap-ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Taro Sitemap\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-09 21:56+0900\n"
"PO-Revision-Date: 2024-07-09 22:14+0900\n"
"POT-Creation-Date: 2024-07-12 17:40+0900\n"
"PO-Revision-Date: 2024-07-12 17:43+0900\n"
"Last-Translator: Takahashi Fumiki <takahashi.fumiki@hametuha.co.jp>\n"
"Language-Team: TAROSKY INC <info@tarosky.co.jp>\n"
"Language: ja\n"
Expand All @@ -23,12 +23,12 @@ msgstr ""
"X-Poedit-SearchPathExcluded-3: wordpress\n"
"X-Poedit-SearchPathExcluded-4: dist\n"

#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:123
#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:124
#, php-format
msgid "Search results for: %s"
msgstr "検索結果: %s"

#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:125
#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:126
msgid "Page not found."
msgstr "ページが見つかりませんでした。"

Expand All @@ -45,7 +45,7 @@ msgid "Make this term noindex for search engines."
msgstr "このタームを検索エンジンで表示しない。"

#: src/Tarosky/Sitemap/Seo/Features/TermNoindex.php:61
#: src/Tarosky/Sitemap/Setting.php:103
#: src/Tarosky/Sitemap/Setting.php:102
msgid "Noindex"
msgstr "ノーインデックス"

Expand All @@ -65,7 +65,7 @@ msgstr "サイトマップとSEO設定"
msgid "Sitemap URL"
msgstr "サイトマップURL"

#: src/Tarosky/Sitemap/Setting.php:62
#: src/Tarosky/Sitemap/Setting.php:61
#, php-format
msgid ""
"The sitemap URL are listed below. You should register these URLs at <a "
Expand All @@ -77,48 +77,60 @@ msgstr ""
"登録する必要があります。URLは <a href=\"%2$s\">robots.txt</a>にも表示されてい"
"ます。"

#: src/Tarosky/Sitemap/Setting.php:75
#: src/Tarosky/Sitemap/Setting.php:74
msgid "No sitemaps are available."
msgstr "サイトマップがありません。"

#: src/Tarosky/Sitemap/Setting.php:102
#: src/Tarosky/Sitemap/Setting.php:101
msgid "Sitemap"
msgstr "サイトマップ"

#: src/Tarosky/Sitemap/Setting.php:102
#: src/Tarosky/Sitemap/Setting.php:101
msgid "Setting for Sitemap."
msgstr "サイトマップの設定です。"

#: src/Tarosky/Sitemap/Setting.php:103
#: src/Tarosky/Sitemap/Setting.php:102
msgid ""
"Add options of noindex for posts and taxonomies. This affects the appearance "
"on search engines."
msgstr "投稿やタクソノーにnoidex設定を追加します。"

#: src/Tarosky/Sitemap/Setting.php:104
#: src/Tarosky/Sitemap/Setting.php:103
msgid "Canonical"
msgstr "カノニカル"

#: src/Tarosky/Sitemap/Setting.php:104
#: src/Tarosky/Sitemap/Setting.php:103
msgid "Canonical URL related features."
msgstr "カノニカルURL関連の設定です。"

#: src/Tarosky/Sitemap/Setting.php:105
#: src/Tarosky/Sitemap/Setting.php:104
msgid "Meta"
msgstr "メタ"

#: src/Tarosky/Sitemap/Setting.php:105
#: src/Tarosky/Sitemap/Setting.php:104
msgid "Additional setting for <code>&lt;head&gt;</code> tag."
msgstr "<code>&lt;head&gt;</code> タグの追加設定です。"

#: src/Tarosky/Sitemap/Setting.php:106
#: src/Tarosky/Sitemap/Setting.php:105
msgid "OGP"
msgstr "OGP"

#: src/Tarosky/Sitemap/Setting.php:106
#: src/Tarosky/Sitemap/Setting.php:105
msgid "OGP setting. Displayed on social media."
msgstr "OGP設定です。ソーシャルメディアで表示されます。"

#: src/Tarosky/Sitemap/Setting.php:106
msgid "Structured Date"
msgstr "構造化データ"

#: src/Tarosky/Sitemap/Setting.php:106
msgid ""
"Display structured data as JSON-LD in <code>&lt;head&gt;</code> tag. Filter "
"hooks <code>tsmap_json_ld</code> is also available."
msgstr ""
"JSON-LDの構造化データを <code>&lt;head&gt;</code> タグ内に表示します。フィル"
"ターフック <code>tsmap_json_ld</code> も利用できます。"

#: src/Tarosky/Sitemap/Setting.php:129
msgid "Core Sitemap"
msgstr "コア・サイトマップ"
Expand Down Expand Up @@ -379,6 +391,38 @@ msgstr "Xカードサイズ"
msgid "Card size shared on X."
msgstr "Xでシェアされたときのカードサイズです。"

#: src/Tarosky/Sitemap/Setting.php:422
#: src/Tarosky/Sitemap/Setting.php:359
msgid "Article Post Type"
msgstr "記事の投稿タイプ"

#: src/Tarosky/Sitemap/Setting.php:362
msgid "Checked post type will display JSON-LD in head tag."
msgstr "チェックした投稿タイプで JSON-LD を head タグに表示します。"

#: src/Tarosky/Sitemap/Setting.php:367
msgid "Publisher Name"
msgstr "発行者名"

#: src/Tarosky/Sitemap/Setting.php:369
msgid "Publisher name of article. Default is site name."
msgstr "記事の発行者名。デフォルトはサイト名です。"

#: src/Tarosky/Sitemap/Setting.php:375
msgid "Publisher URL"
msgstr "発行者URL"

#: src/Tarosky/Sitemap/Setting.php:377
msgid "Publisher URL of article. Default is site URL."
msgstr "記事発行者のURL。デフォルトはサイトURLです。"

#: src/Tarosky/Sitemap/Setting.php:383
msgid "Publisher Logo"
msgstr "発行者ロゴ"

#: src/Tarosky/Sitemap/Setting.php:385
msgid "Attachment ID of the publisher. Default is site icon."
msgstr "発行者ロゴの添付ファイルID。デフォルトはサイトアイコンになります。"

#: src/Tarosky/Sitemap/Setting.php:454
msgid "Preview: "
msgstr "プレビュー:"
74 changes: 58 additions & 16 deletions languages/tsmap.pot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Taro Sitemap\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-09 21:56+0900\n"
"POT-Creation-Date: 2024-07-12 17:40+0900\n"
"PO-Revision-Date: 2014-04-02 22:50+0900\n"
"Last-Translator: Takahashi Fumiki <info@takahashifumiki.com>\n"
"Language-Team: TAROSKY INC <info@tarosky.co.jp>\n"
Expand All @@ -23,12 +23,12 @@ msgstr ""
"X-Poedit-SearchPathExcluded-3: wordpress\n"
"X-Poedit-SearchPathExcluded-4: dist\n"

#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:123
#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:124
#, php-format
msgid "Search results for: %s"
msgstr ""

#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:125
#: src/Tarosky/Sitemap/Seo/Features/AutoDescription.php:126
msgid "Page not found."
msgstr ""

Expand All @@ -45,7 +45,7 @@ msgid "Make this term noindex for search engines."
msgstr ""

#: src/Tarosky/Sitemap/Seo/Features/TermNoindex.php:61
#: src/Tarosky/Sitemap/Setting.php:103
#: src/Tarosky/Sitemap/Setting.php:102
msgid "Noindex"
msgstr ""

Expand All @@ -65,56 +65,66 @@ msgstr ""
msgid "Sitemap URL"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:62
#: src/Tarosky/Sitemap/Setting.php:61
#, php-format
msgid ""
"The sitemap URL are listed below. You should register these URLs at <a "
"href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">Google Search "
"Console</a>. They also appear in <a href=\"%2$s\">robots.txt</a>."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:75
#: src/Tarosky/Sitemap/Setting.php:74
msgid "No sitemaps are available."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:102
#: src/Tarosky/Sitemap/Setting.php:101
msgid "Sitemap"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:102
#: src/Tarosky/Sitemap/Setting.php:101
msgid "Setting for Sitemap."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:103
#: src/Tarosky/Sitemap/Setting.php:102
msgid ""
"Add options of noindex for posts and taxonomies. This affects the "
"appearance on search engines."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:104
#: src/Tarosky/Sitemap/Setting.php:103
msgid "Canonical"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:104
#: src/Tarosky/Sitemap/Setting.php:103
msgid "Canonical URL related features."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:105
#: src/Tarosky/Sitemap/Setting.php:104
msgid "Meta"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:105
#: src/Tarosky/Sitemap/Setting.php:104
msgid "Additional setting for <code>&lt;head&gt;</code> tag."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:106
#: src/Tarosky/Sitemap/Setting.php:105
msgid "OGP"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:106
#: src/Tarosky/Sitemap/Setting.php:105
msgid "OGP setting. Displayed on social media."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:106
msgid "Structured Date"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:106
msgid ""
"Display structured data as JSON-LD in <code>&lt;head&gt;</code> tag. "
"Filter hooks <code>tsmap_json_ld</code> is also available."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:129
msgid "Core Sitemap"
msgstr ""
Expand Down Expand Up @@ -361,6 +371,38 @@ msgstr ""
msgid "Card size shared on X."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:422
#: src/Tarosky/Sitemap/Setting.php:359
msgid "Article Post Type"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:362
msgid "Checked post type will display JSON-LD in head tag."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:367
msgid "Publisher Name"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:369
msgid "Publisher name of article. Default is site name."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:375
msgid "Publisher URL"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:377
msgid "Publisher URL of article. Default is site URL."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:383
msgid "Publisher Logo"
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:385
msgid "Attachment ID of the publisher. Default is site icon."
msgstr ""

#: src/Tarosky/Sitemap/Setting.php:454
msgid "Preview: "
msgstr ""
6 changes: 6 additions & 0 deletions src/Tarosky/Sitemap/Pattern/PostMetaBoxTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ trait PostMetaBoxTrait {
*/
abstract public function is_active_post_type( $post_type ): bool;

/**
* Register metabox hooks.
*
* @param int $priority Hook priority.
* @return void
*/
protected function add_meta_box( $priority = 11 ) {
add_filter( 'tsmap_has_meta_box', [ $this, 'has_meta_box' ], $priority, 2 );
add_action( 'tsmap_do_meta_box', [ $this, 'do_meta_box' ], $priority );
Expand Down
8 changes: 8 additions & 0 deletions src/Tarosky/Sitemap/Seo/Features/OgpGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public function render_ogp() {
$image = $attachment;
}
}
// Set date on singular
if ( is_singular() && is_a( get_queried_object(), 'WP_Post' ) ) {
$post = get_queried_object();
$ogp['article:published_time'] = mysql2date( \DateTime::ATOM, $post->post_date );
if ( $post->post_date < $post->post_modified ) {
$ogp['article:modified_time'] = mysql2date( \DateTime::ATOM, $post->post_modified );
}
}
if ( is_singular() && has_post_thumbnail( get_queried_object() ) ) {
$image = wp_get_attachment_image_url( get_post_thumbnail_id( get_queried_object() ), 'full' );
}
Expand Down
Loading

0 comments on commit 6710efd

Please sign in to comment.