=== SU Blocks - Blogcard ===
Contributors: ejointjp
Tags: link, blog, blogcard, card, url
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.3.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A WordPress plugin that makes it easy to create blog cards. Simply enter a URL and automatically fetch metadata to display beautiful cards.

== Description ==

WordPress's standard URL embedding feature only works with WordPress sites.

This plugin was created to display any link destination as a stylish card with thumbnails.

Just paste the URL into the block editor. Blog cards are displayed in an instant.

New features from version 2.0.0 include the ability to create blog cards from site search.
This allows you to search for articles within your own site and convert them into blog cards.

> **Important Notice:**
> Starting from version 2.1.0, the block is rendered dynamically on the server side to improve stability.
> **Note:** Manual edits made via "Edit as HTML" will be reset to the standard design.
> If you see "Attempt Block Recovery" after updating, please click the button to recover the block.

== External services ==

This plugin relies on the following third-party service.

**Google Favicon Service** (https://www.google.com/s2/favicons)

When a blog card has no favicon of its own, the card falls back to a favicon supplied by Google. The image is requested by the visitor's browser while the page is being displayed, so the visitor's IP address, user agent, and the domain name of the linked site are sent to Google.

This happens only on pages that contain a blog card whose favicon could not be determined when the card was created.

* Terms of service: https://policies.google.com/terms
* Privacy policy: https://policies.google.com/privacy

Separately, when you create or refresh a blog card, your server fetches the page at the URL you entered in order to read its title, description, thumbnail and favicon. That request is made by your site, not by your visitors, and it sends no information about them.

== Key Features ==

* **Easy Operation**: Simply enter a URL and press Enter to instantly generate a blog card
* **Universal Compatibility**: Works with non-WordPress sites (note, Zenn, Qiita, GitHub, etc.)
* **Automatic Metadata Fetching**: Automatically retrieves title, description, and thumbnail images
* **Customizable**: Retrieved information can be edited later
* **SEO Friendly**: Set rel attributes like nofollow, noreferrer, sponsored, ugc
* **Responsive Design**: Beautiful display on mobile devices
* **Caching**: Caches retrieved metadata for fast display
* **Site Search**: Search and convert internal posts into blog cards
* **Dark Mode Support**: Switches to a dark palette while the page has a data-theme="dark" attribute
* **Advanced Management**: Configure default link targets, cache duration, and manual favicon support

== Installation ==

1. Upload plugin files to `/wp-content/plugins/blogcard-for-wp/` directory
2. Activate the plugin from the 'Plugins' menu in WordPress admin
3. Add the 'Blog Card' block in post/page editor
4. Enter a URL and press Enter to automatically generate a blog card

== Usage ==

=== Basic Usage ===

1. Click the '+' button in the post/page editor
2. Search for and select 'Blog Card'
3. Enter the destination URL in the URL input field
4. Press Enter to automatically fetch metadata and generate a blog card

=== Advanced Settings ===

When the block is selected, the following settings appear in the right sidebar:

* **URL**: Destination URL
* **TARGET Attribute**: How to open the link (_blank, _self, etc.)
* **Rel Attributes**: noopener, nofollow, noreferrer, sponsored, ugc
* **Thumbnail**: Show/hide thumbnail image
* **Title**: Manual title editing
* **Description**: Manual description editing
* **Thumbnail Image**: Manual thumbnail image setting

== Frequently Asked Questions ==

= Can any site URL be converted to a blog card? =

Yes, basically any site URL can be converted to a blog card. However, some sites may not allow metadata retrieval.

= Can retrieved metadata be edited? =

Yes, title, description, and thumbnail images can be edited later. Link attributes (target, rel, etc.) can also be changed freely.

= How is caching managed? =

Retrieved metadata is automatically cached and displayed quickly for the same URL. The cache can be cleared manually from the "Cache Management" section of the block settings sidebar, either for the selected card or for all blog cards. The cache lifetime is configured under Settings > SU Blogcard.

= Does it display correctly on mobile? =

Yes, it supports responsive design and displays beautifully on mobile devices.

= Does it affect SEO? =

By setting appropriate rel attributes (nofollow, etc.), you can create SEO-friendly links.

== Screenshots ==

1. Instantly create beautiful blog cards.

== Changelog ==

= 2.3.9 =
* Fixed a bug in cache clearing. "Clear this blogcard's cache" now clears only that one card.
* Fixed garbled titles and descriptions on pages published in Shift_JIS or EUC-JP. This also stops deprecation notices on PHP 8.2 and later.
* Fixed the interface not being translated.
* Fixed an endless chain of internal requests when a card pointing at the front page was placed on that same page.
* Fixed a failed favicon or OG image lookup for your own site being cached for a long time.
* Made site search and favicon checks lighter.
* Unified outgoing requests on WordPress's safe HTTP functions, and added validation of settings values.

= 2.3.8 =
* Fixed the plugin writing diagnostic messages to the server error log during normal operation. These are now written only when WP_DEBUG is enabled.
* Internal code cleanup to follow the WordPress Coding Standards. The appearance and behavior of blog cards are unchanged.

= 2.3.7 =
* Simplified the block's dark mode color handling to work reliably regardless of the active theme.

= 2.3.6 =
* Fixed the plugin icon to display correctly in the plugin directory.
* Added a banner image for the plugin directory.

= 2.3.5 =
* Updated the plugin icon.
* Updated "Tested up to" to WordPress 7.0.

= 2.3.4 =
* Improved: Added `aria-label` to the blogcard link for better screen reader accessibility.
* Improved: Refactored CSS to align with design token conventions.

= 2.3.3 =
* Fixed: Resolved an issue where titles and descriptions containing HTML entities (like `&` or `<`) were double-escaped and displayed incorrectly (e.g., `&amp;amp;`).

= 2.3.2 =
* CSS Fixed.

= 2.3.1 =
* Improved: Added spinner and loading message during site search.
* Fixed: Favicon not showing correctly during site search.
* Fixed: Error occurring when entering the site's Home URL.
* Improvement: Enhanced visibility of the loading indicator in the editor.

= 2.2.1 =
* Bug fixes and minor adjustments.

= 2.2.0 =
* New Feature: Added settings page for default link target attributes and cache configuration.
* New Feature: Added ability to manually set Favicon URL.
* Improvement: Updated block editor UI layout.
* Improvement: Added option to delete plugin data on uninstallation.
* Update: Refactored internal code structure.

= 2.1.2 =
* Update CSS.

= 2.1.1 =
* Bug fixes.
* Update CSS.

= 2.1.0 =
* Major Update: Switched to Server Side Rendering (Dynamic Block) to improve stability and prevent block validation errors.
* Performance: Improved rendering performance by utilizing server-side processing.
* Note: Manual HTML edits via "Edit as HTML" will be overridden by the dynamic renderer.

= 2.0.8 =
* Update version.

= 2.0.7 =
* Update CSS variables.

= 2.0.4 =
* Update CSS.

= 2.0.0 =
* Significantly improved block editor UI
* Added site search functionality
* Enhanced error handling
* Optimized performance
* Improved responsive design
* Enhanced accessibility

= 1.0.7 =
* Bug fixes
* Improved metadata retrieval stability

= 1.0.0 =
* Initial release
* Basic blog card functionality
* Automatic metadata fetching
* Customization features

== Upgrade Notice ==

= 2.1.0 =
Major Update: Switched to Server Side Rendering for better stability. Please check your block appearance.

= 2.0.0 =
Major feature improvements and UI refresh have been implemented. Existing blog cards will continue to work, but we recommend upgrading to take advantage of new features.

= 1.0.7 =
This is a bug fix version. We recommend upgrading.

== Support ==

For questions about the plugin or bug reports, please use the following methods:

* GitHub Issues: [Plugin repository URL]
* Email: [Support email address]

== Developer Information ==

This plugin is developed using the following technologies:

* WordPress Block Editor (Gutenberg)
* React
* WordPress REST API
* PHP 7.4 or higher

If you would like to customize or add features, please send a pull request to the GitHub repository.

== License ==

This plugin is released under the GPLv2 or later license.

== Acknowledgments ==

In developing this plugin, we referenced the following open source projects:

* WordPress
* React
* Other open source libraries

== Development ==

This plugin is actively maintained and developed. Contributions are welcome!

For development setup and contribution guidelines, please refer to the GitHub repository.