mod_import_feed

Discover RSS 2.0, RSS 1.0/RDF and Atom feeds and automatically import articles and media.

Administrator accounts cannot run imports. Select an enabled non-administrator account with only the required import permissions. This is checked when saving settings and before polling, including for existing feeds whose account is later promoted to admin.

Setup and administration

Enable Import feeds in Modules and open Content > Import feeds. The module requires mod_admin and mod_cron. Enter a website or feed URL, select one of the discovered feeds, and review three example entries beside the import settings. Discovery uses HTML alternate links and HTTP Link headers.

Managing feeds requires use permission for mod_import_feed. New feeds default to the current editor. Administrators and users with use permission for mod_admin_identity can select another enabled account with Select user. Saving records that account and its user groups for background imports; ordinary settings edits preserve the selected account and saved groups. The worker checks that the editor is still enabled and uses the editor's current, bounded permissions. Resource, media and edge operations enforce their normal ACLs; imported HTML is sanitized.

Per-feed settings

Settings are stored in the feed table. There are no m_config options.

SettingBehavior
Import userDefaults to the creator. Only administrators or users with full account access can select or change it.
Default categoryAn existing non-meta category; initially Article.
Content groupAvailable when mod_content_groups is enabled. Empty uses the site default.
Guess categoryMatch tags against existing category names or translated titles, case-insensitively; otherwise use the default category.
Default connectionsUse Add connection to select a predicate and page. Remove entries from the list as needed, then save. Existing article connections are preserved.
MediaDependent resources with depiction edges, the most important medium attached directly, or no media import.
Fetch usingAnonymous by default, or registered OAuth2 credentials for the import user and destination host.
Polling interval5 to 10080 minutes; initially 60 minutes.
AuthorityNon-authoritative by default; authoritative copies also retain source identities.
WordPress enrichmentEnabled initially in the admin form; use the anonymous public REST API for content, author, dates and featured media. Failures fall back to feed data.
PauseSuspend automatic imports. New feeds are active unless saved paused.

Imports create published resources. Dependent media are created through m_media, which detects the MIME type and selects the appropriate media category. For each inline image, the importer selects one variant, preferring the largest declared srcset width or density, with src as fallback. Imported variants share one local medium and inline references are rewritten to its URL. WordPress featured-image variants reuse the original image. In attached mode, other inline images retain their source URLs.

Fetch authentication and development

Discovery can use the current user's registered OAuth2 consumer credentials. Saved feeds use their selected import user's credentials for previews and polling. Tokens are resolved per destination host and port, only over HTTPS, and are never stored in feed settings. Missing credentials leave a request anonymous. Native imports save their fetch preference for core reimports and medium downloads.

Development sites allow local destinations and self-signed TLS certificates. Transport, redirects and certificate checks use the shared z_fetch routines; browser input cannot change the server's environment. OAuth2 credentials are never sent over HTTP. Anonymous fetching remains anonymous across redirects.

Polling and identity

The minute tick starts a bounded background job for due feeds. Database leases prevent concurrent claims. The overview shows article counts, cumulative import/update/skip/error statistics and poll times. Each feed has settings, pause/resume, test/preview, poll-now, reimport and paginated history for articles and dependent media.

Stable source URIs and checksums allow repeated polls without duplicates. Reimport processes only entries currently present in the feed, preserving resource IDs. Deleted resources remain deleted. Media already imported from the same URL is reused. Feeds with more than 100 entries are rejected, rather than silently importing a partial feed. WebSub hub links are recognized in feed data; feed fetching uses polling.

Zotonic resource feeds

Atom entries from mod_export advertise a JSON resource link with relation https://zotonic.com/rel/resource. These use m_rsc_import, preserving native properties, categories, media embeds and connections. Connection import depth defaults to 1 and accepts 0–10. Content-group/copyright defaults and cleanup patterns apply; category guessing and media-layout choices do not reshape native resources. Choosing no media disables native medium downloads.

With mod_websub enabled, optional subscriptions cover imported articles and, when selected, their connections within the import depth. Both options default to false and require non-authoritative imports and a supporting source. Existing subscriptions are managed separately through WebSub administration. Native resources use the core Fetch new version flow and saved import options, without requiring the entry to remain in the feed. These refreshes use the core import notification with native resource source metadata.

Fetch new version

For ordinary feed entries, the rsc_import_fetch observer refreshes known imported articles from their current feed, using the saved settings and import account. The caller needs feed-management and article-edit permission. Paused feeds can be refreshed manually without resuming polling. This bypasses unchanged checksums and still runs the import notification. An article no longer present in the feed returns feed_entry_not_found; unknown URIs fall through to the standard resource importer.

Import notification

Before writing an entry or its media, the importer dispatches the core #import_resource{item, related, source, options, raw} notification. The source is #{importer => mod_import_feed, feed => Settings}. Include zotonic_core/include/zotonic.hrl, declare zotonic_observer, and implement observe_import_resource/2 or its optional PID-aware variant. See the core observer documentation for the payload, permissions and result contract.

Unchanged and deleted entries are skipped before notifying. Native feed entries notify once; their delegation to m_rsc_import preserves this scope, while recursively imported resources may generate separate notifications.

Edit on GitHub

Observes

Notifications

observe_rsc_import_fetch/2

Fetch the data for an import of a resource. Returns data in the format used by m_rsc_export and m_rsc_import. Either returns the JSON data, the imported…

Models

Models

import_feed

Discover, preview and manage the feeds imported by mod_import_feed .

Dispatch rules