Skip to content

Commit d9640bc

Browse files
Merge pull request #65 from Prisjakt/feat/restructure-docs
feat: Restructure docs
2 parents a2dee45 + 3fba509 commit d9640bc

File tree

173 files changed

+3330
-1189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+3330
-1189
lines changed

.idea/feed-specification.iml

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/advanced/_category_.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"label": "Advanced",
3-
"position": 9
2+
"label": "Advanced Topics",
3+
"position": 8
44
}

docs/advanced/escaping/escape-csv.md renamed to docs/advanced/csv/escaping-data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Escaping data in CSV
1+
# Escaping Data
22

3-
If you need to use commas `,` within the value of your offers (for example in a title or a description) then we expect the csv cell to be enclosed in quotes `"` according to [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180.html#section-2). For more information about our CSV support see our [CSV file format article](/types-of-feeds/pull/file-formats/csv.md).
3+
If you need to use commas `,` within the value of your offers (for example in a title or a description) then we expect the csv cell to be enclosed in quotes `"` according to [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180.html#section-2). For more information about our CSV support see our [CSV file format article](/advanced/csv/index.md).
44

55
> Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes.
66

docs/types-of-feeds/pull/file-formats/csv.md renamed to docs/advanced/csv/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
sidebar_position: 2
2+
sidebar_position: 1
33
---
44

55
# CSV
66

77
:::caution Recommendation
88

9-
While CSV is lightweight and easy to use, [XML](./xml.md) is more well defined and have better support for handling complex data encodings and strctures. We recommend using XML over CSV.
9+
While CSV is lightweight and easy to use, [XML](/advanced/xml/index.md) is more well defined and have better support for handling complex data encodings and strctures. We recommend using XML over CSV.
1010

1111
:::
1212

1313
[CSV](https://en.wikipedia.org/wiki/Comma-separated_values) stands for **c**omma **s**eparated **v**alues. It is a simple format very similar to having data organized in a spreadsheet. The CSV format is not fully standarized even if a proposed [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180.html) exists and different software often interprets the structures differently.
1414

1515
## Format
1616

17-
We expect the following structure (following [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180.html)) on CSV files, for a full example please see the [CSV tab on our full example](/examples/offer/all.mdx)
17+
We expect the following structure (following [RFC4180](https://datatracker.ietf.org/doc/html/rfc4180.html)) on CSV files, for a full example please see the [CSV tab on our full example](/feeds/offer/formats/prisjakt_xml/index.md#full)
1818

1919
- First row is a header row
2020

@@ -42,7 +42,7 @@ We expect the following structure (following [RFC4180](https://datatracker.ietf
4242

4343
## Escaping
4444

45-
Escaping values in CSV can be tricky, see [our section about escaping](/advanced/escaping/escape-csv.md) for more details
45+
Escaping values in CSV can be tricky, see [our section about escaping](/advanced/csv/escaping-data.md) for more details
4646

4747
## Encoding sub-attributes and lists in CSV files
4848
While the XML format is well suited for sub-attributes (child elements) and lists (repeated elements), the CSV format is not so.

docs/advanced/encoding/index.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/advanced/escaping/index.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/advanced/encoding/file-encoding.md renamed to docs/advanced/file-encoding.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
sidebar_position: 1
3+
---
14
import Tabs from '@theme/Tabs';
25
import TabItem from '@theme/TabItem';
36

docs/advanced/encoding/url-encode.md renamed to docs/advanced/url-encode.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
---
2+
sidebar_position: 2
3+
---
14
# Url Encoding
25

36
[![What Is An Url?](@site/docs/assets/url.png)](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL)
47

5-
URLs are complex datatypes that carry a lot of information and can be a bit hard to handle sometimes. In this article we will try to explain how to deal with some tricky but not uncommon cases. All fields that are of type URL such as the [link](/fields/offer/link) field have both [valid examples](/fields/offer/link#example-values) and [invalid examples](/fields/offer/link#error-codes) of URLs in their respective sections.
8+
URLs are complex datatypes that carry a lot of information and can be a bit hard to handle sometimes. In this article we will try to explain how to deal with some tricky but not uncommon cases. All fields that are of type URL such as the [link](/feeds/offer/fields/link) field have both [valid examples](/feeds/offer/fields/link#example-values) and [invalid examples](/feeds/offer/fields/link#error-codes) of URLs in their respective sections.
69

710
The image above is borrowed from Mozilla MDN[^1].
811

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"label": "XML",
23
"position": 2
34
}

docs/advanced/encoding/cdata.md renamed to docs/advanced/xml/cdata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CDATA in XML Files
22

3-
Since XML is a tag based language: `<tag>content</tag>` some characters like brackets (`<` or `>`) are reserved for the XML markup itself. If your data contains these characters it may cause a parser to become confused. We recommend that you embed **all fields that contain string values** in [CDATA](/advanced/encoding/cdata) tags in order to avoid the risk of your content causing troubles for our parser.
3+
Since XML is a tag based language: `<tag>content</tag>` some characters like brackets (`<` or `>`) are reserved for the XML markup itself. If your data contains these characters it may cause a parser to become confused. We recommend that you embed **all fields that contain string values** in [CDATA](/advanced/xml/cdata.md) tags in order to avoid the risk of your content causing troubles for our parser.
44

55
```xml
66
<g:field><![CDATA[your complex string with special xml markup characters]]></g:field>

docs/advanced/xml/index.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
```mdx-code-block
6+
import DocCardList from '@theme/DocCardList';
7+
8+
<DocCardList />
9+
```
10+
11+
12+
# XML
13+
14+
## Overview
15+
16+
[XML](https://en.wikipedia.org/wiki/XML) stands for e**X**tensinble **M**arkup **L**anguage. It is very similar to HTML except it doesn't have any predefined tags. It's a meta language that allows you to define your own markup language which then can be used to store and share data in a structured manner.
17+
18+
## Namespaces
19+
A Prisjakt offer feed should use two namespaces, the `g` namespace which most fields belong to that are defined by the Google Product Specification and then the `pj` namespace which contains some [additional Prisjakt specific fields](/feeds/offer/formats/prisjakt_xml/#prisjakt-specific-fields) defined by us.
20+
21+
Offers: https://schema.prisjakt.nu/ns/1.0
22+
23+
```xml
24+
<rss xmlns:pj="https://schema.prisjakt.nu/ns/1.0" xmlns:g="http://base.google.com/ns/1.0" version="3.0">
25+
```
26+
27+
Promotions: https://schema.prisjakt.nu/ns/promotions-1.0
28+
29+
```xml
30+
<rss xmlns:pj="https://schema.prisjakt.nu/ns/promotions-1.0" xmlns:g="http://base.google.com/ns/1.0" version="3.0">
31+
```
32+
33+
### Namespace Priority When Parsed
34+
35+
If multiple fields with the same name but different namespaces exist, the field will be parsed with the following priority:
36+
37+
1. `pj:` first eg. `<pj:some_field>Some pj field</pj:some_field>`
38+
1. `g:` second eg. `<g:some_field>Gome g field</g:some_field>`
39+
1. **no namespace** third eg. `<some_field>Some field</some_field>`
40+
1. **other/unknown** in undefined order eg. `<xyz:some_field>Some xyz field</xyz:some_field>`
41+
42+
## Recommendations
43+
44+
### Use UTF-8
45+
46+
All XML feeds should start with the following header and the files should be properly [UTF-8 encoded](/advanced/file-encoding.md).
47+
48+
Do not use [control characters](https://en.wikipedia.org/wiki/Control_character) in feed file. We support some of them trying to follow [XML spec](https://en.wikipedia.org/wiki/Valid_characters_in_XML) but not guarantee to fully support it.
49+
50+
```
51+
<?xml version='1.0' encoding='UTF-8'?>
52+
```
53+
54+
### Use CDATA
55+
56+
You should lower the risk of your data causing xml parsers to fail because of invalid data by encoding your data correctly. Take a look on our [CDATA](/advanced/xml/cdata.md) article to achieve this.

docs/advanced/encoding/xml-escaping.md renamed to docs/advanced/xml/xml-escaping.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Special Characters in XML
22

3-
It is possible to escape special characters in [XML](/types-of-feeds/pull/file-formats/xml.md) (see [this answer](https://stackoverflow.com/a/1091953) and [this answer](https://stackoverflow.com/a/46637835)) using number notations such as this example:
3+
It is possible to escape special characters in [XML](/advanced/xml/index.md) (see [this answer](https://stackoverflow.com/a/1091953) and [this answer](https://stackoverflow.com/a/46637835)) using number notations such as this example:
44

55

66
```
@@ -19,6 +19,6 @@ In order to test conversion and encoding you can use one of the many available o
1919
Joe&#39;s Caf&#233; &amp; Bar &#9835;
2020
```
2121

22-
But in the case of product feeds, **you should never need to do this** as long as your XML file is [UTF-8 encoded](./file-encoding.md) and that **all fields containing strings** are [wrapped in CDATA tags](./cdata.md).
22+
But in the case of product feeds, **you should never need to do this** as long as your XML file is [UTF-8 encoded](/advanced/file-encoding.md) and that **all fields containing strings** are [wrapped in CDATA tags](./cdata.md).
2323

24-
Please note that for URLs we are more strict and require them to be [url encoded](./url-encode.md) properly according to RFC specification.
24+
Please note that for URLs we are more strict and require them to be [url encoded](/advanced/url-encode.md) properly according to RFC specification.

docs/examples/_category_.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/examples/index.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/examples/offer/_category_.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/examples/offer/_csv_sample.mdx

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/examples/offer/all.mdx

Lines changed: 0 additions & 31 deletions
This file was deleted.

docs/examples/offer/minimal.mdx

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/examples/promotion/_category_.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/examples/promotion/promotion-all.mdx

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/examples/promotion/promotion-minimal.mdx

Lines changed: 0 additions & 18 deletions
This file was deleted.

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 13
2+
sidebar_position: 10
33
---
44

55
# FAQ

docs/feeds/_category_.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Feeds",
3+
"position": 3
4+
}

docs/feeds/index.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Feeds
2+
3+
```mdx-code-block
4+
import DocCardList from '@theme/DocCardList';
5+
6+
<DocCardList />
7+
```
8+
9+
We support feeds for different types of entities that can be used to integrate with us.
10+
11+
- **Offer feed** is the most common feed type, compatible with Google Merchant Feed and is the way shops provide us with prices and stock status.
12+
- **Promotion feed** is a way for shops to automate promotion campains through us. Visible at [the promotions page](https://prisjakt.nu/kampanjer).
13+
- **Product feed** is intended for manufacturers who wants to provide us with detailed product information of the products they create.
14+
15+
The flow of the feeds is a simple polling mechanism where you provide us with a URL to your feed and we will poll it according to your SLA.
16+
17+
```mermaid
18+
%%{init: {'theme':'neutral'}}%%
19+
sequenceDiagram
20+
participant A as Prisjakt Agent
21+
participant F as Your Web Server
22+
23+
loop Periodically according to your SLA
24+
A->>F: Requests Feed: <Your Feed Url>
25+
F->>A: Responds With Feed
26+
A->>A: Ingests Feed Data
27+
end
28+
```
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"label": "Offer",
3-
"position": 1
4-
}
3+
"position": 3
4+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"label": "Fields",
3-
"position": 4
3+
"position": 3
44
}

0 commit comments

Comments
 (0)