Skip to content

Commit

Permalink
More docs language cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustMiller committed Aug 14, 2024
1 parent e0f3ea1 commit 1f2ecc6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 27 deletions.
18 changes: 14 additions & 4 deletions docs/feature-tour/creating-your-feed.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ Setup a name for you feed, so you can easily keep track of what you're importing

### Feed URL

Provide the URL for your feed. This can be an absolute URL, relative (to the web root) and make use of any [aliases](https://docs.craftcms.com/v3/config/#aliases).
Provide the URL for your feed. This can be complete URL, an absolute path beneath your site’ web root, a filesystem path, or an [alias](https://craftcms.com/docs/5.x/configure.html#aliases) thereof. These are all valid settings for a **Feed URL**:

- `https://api.myservice.com/v1/products`
- `/uploads/finishes.json`
- `@web/artists.xml`
- `/tmp/crm-export/daily-sales-report.csv`
- `@root/private/subscribers.json`

::: tip
If you use the `@web` alias in any URLs, make sure it's defined for console requests.
:::

### Feed Type

Set the Feed Type to match the type of data you're importing. Your options are:
Set the **Feed Type** to match the type of data you're importing. Your options are:

- ATOM
- CSV
Expand All @@ -34,7 +44,7 @@ Select the [element type](../content-mapping/element-types.md) you wish to impor

### Target Site

If you have a multi-site Craft installation, you'll have an additional Target Site setting where you can select which site the elements should be initially saved in. The content will get propagated to your other sites from there, according to your fields’ Translation Method settings.
Multi-site Craft installations will display an additional **Target Site** setting where you can select which site the elements should be initially saved in. The content will get propagated to your other sites from there, according to your fields’ [Translation Method](https://craftcms.com/docs/5.x/system/fields.html#translation-methods).

### Import Strategy

Expand All @@ -59,7 +69,7 @@ Attribute | Description

### Passkey

A generated, unique string to increase security against imports being run inadvertently. This is mainly used when triggering an import via the direct feed link.
A generated, unique string to increase security against imports being run inadvertently. This is mainly used when [triggering an import](trigger-import-via-cron.md) via HTTP using the direct feed link.

### Backup

Expand Down
36 changes: 21 additions & 15 deletions docs/feature-tour/trigger-import-via-cron.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ https://my-project.ddev.site/index.php?action=feed-me/feeds/run-task&direct=1&fe
- `direct` (required) - Must be set to 1 or true. Tells Feed Me this is a externally-triggered queue job.
- `feedId` (required) - The ID of the feed you wish to process.
- `passkey` (required) - A unique, generated identifier for this feed. Ensures not just anyone can trigger the import.
- `url` (optional) - If your feed URL changes, you can specify it here. Ensure the structure of the feed matches your field mappings.
- `url` (optional) - If your feed URL changes (or is split/parameterized in some way, like using the current date), you can override it here. Ensure the structure of the feed matches your field mappings.

::: warning
Feed IDs and passkeys may not be the same, across environments. Always refer to the control panel for the complete URL.
:::

#### Setup

Expand All @@ -32,28 +36,30 @@ curl --silent --compressed "https://my-project.ddev.site/index.php?action=feed-m

### Console command

You can also trigger your feed to process via a console command by passing in a comma-separated list of feed IDs to process. You can also use `limit` and `offset` parameters.
You can also trigger your feed via Craft’s CLI by passing a comma-separated list of feed IDs:

```bash
> php craft feed-me/feeds/queue 1

> php craft feed-me/feeds/queue 1,2,3

> php craft feed-me/feeds/queue 1 --limit=1

> php craft feed-me/feeds/queue 1 --limit=1 --offset=1
php craft feed-me/feeds/queue 1

> php craft feed-me/feeds/queue 1 --continue-on-error
php craft feed-me/feeds/queue 1,2,3
```

You can also supply a `--all` parameter to push all feeds into the queue. Note that this parameter will ignore any `--limit` and `--offset` parameters supplied.
You can also use `limit` and `offset` parameters:

```bash
> php craft feed-me/feeds/queue --all
````
php craft feed-me/feeds/queue 1 --limit=1

Note that the `feed-me/feeds/queue` command will only queue up the importing job. To actually run the import, you will need to run your queue. You can do that by running the `queue/run` command:
php craft feed-me/feeds/queue 1 --limit=1 --offset=1

php craft feed-me/feeds/queue 1 --continue-on-error
```

Use the `--all` flag to push _all_ your feeds into the queue. This parameter ignores `--limit` and `--offset` settings.

```bash
> php craft queue/run
php craft feed-me/feeds/queue --all
```

::: warning
The `feed-me/feeds/queue` command only _queues_ import jobs. To actually execute those jobs, the queue must be running—by default, the queue is triggered when your site is loaded by a client, or a control panel user is active. Projects with many feeds may benefit from setting up a [daemonized runner](https://craftcms.com/docs/5.x/system/queue.html#daemon), or manually running the queue [on a schedule](https://craftcms.com/docs/5.x/system/queue.html#cron).
:::
12 changes: 8 additions & 4 deletions docs/feature-tour/using-in-your-templates.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Using in your Templates

While you can create a feed queue job to insert data as elements, there are times which you may prefer to capture feed data on-demand, rather than saving as an entry. You can easily do this through your twig templates using the below.
While you can create a feed queue job to insert data as elements, there are times when you may prefer to capture feed data on-demand. You can easily do this in your Twig templates using Feed Me’s API.

Feeds are cached for performance (default to 60 seconds), which can be set by a tag parameter, or in the plugin settings.

```twig
```twig{5}
{% set params = {
url: 'http://path.to/feed/',
type: 'xml',
Expand All @@ -19,9 +19,13 @@ Feeds are cached for performance (default to 60 seconds), which can be set by a
{% endfor %}
```

::: danger
Do not issue requests to user-supplied URLs! If you must parameterize a feed URL, validate the incoming data, first.
:::

#### Parameters

- `url` (string, required) - URL to the feed.
- `url` (string, required) - URL or path to the feed.
- `type` (string, optional) - The type of feed you're fetching data from. Valid options are json or xml (defaults to xml).
- `element` (string, optional) - Element to start feed from. Useful for deep feeds.
- `cache` (bool or number, optional) - Whether or not to cache the request. If true, will use the default as set in the plugin settings, or if a number, will use that as its duration. Setting to false will disable cache completely.
Expand Down Expand Up @@ -82,4 +86,4 @@ Type: Half-day

:::tip
There's a special case for XML-based feeds, which is illustrated above when attributes are present on a node. To retrieve the node value, use `['@']`, and to fetch the attribute value, use `['@attribute_name']`.
:::
:::
10 changes: 6 additions & 4 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ You may also need to adjust the `memory_limit` and `max_execution_time` values i

### Unexpected Results

If you're experiencing unexpected results when running an import, try to isolate the issue by selectively mapping fields until you have a bare-minimum import.

For example, if you're mapping 20+ fields for an Entry import, but it isn't working, try to map just the Title field, and work your way through mapping additional fields until things stop working as expected.
If you're getting unexpected results when running an import, try to isolate the issue by selectively mapping fields until you have a bare-minimum import. For example, if you're mapping 20+ fields for an entry import, try to map just the **Title** field, and work your way through mapping additional fields until things stop working.

### Logging

Feed Me create a log event for just about everything it does, including errors and other status information. If you're experiencing issues or unexpected results with a Feed, consult the **Logs** tab first.
Feed Me records verbose logs as it reads feed data, matches elements, and applies changes. If you're experiencing issues or getting unexpected results with a Feed, consult the **Logs** tab first.

![The Logs tab](./screenshots/feedme-logs.png)

::: tip
For some steps, log messages are stored hierarchically, and collapses groups of messages. Expand a group using the **Show detail** action at the right edge of a message.
:::

### Debugging

Feed Me includes a special view to assist with debugging your feed, should you encounter issues or errors during an import. With [devMode](https://craftcms.com/docs/config-settings#devMode) enabled, click the “gear” in the problematic feed’s row to expand its utility drawer, then click **Debug**.
Expand Down

0 comments on commit 1f2ecc6

Please sign in to comment.