multisite-cms-mcp 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/get-conversion-guide.d.ts.map +1 -1
- package/dist/tools/get-conversion-guide.js +22 -1
- package/dist/tools/get-example.d.ts.map +1 -1
- package/dist/tools/get-example.js +36 -14
- package/dist/tools/get-schema.d.ts.map +1 -1
- package/dist/tools/get-schema.js +60 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-conversion-guide.d.ts","sourceRoot":"","sources":["../../src/tools/get-conversion-guide.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"get-conversion-guide.d.ts","sourceRoot":"","sources":["../../src/tools/get-conversion-guide.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAyqB1H;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAkD1E"}
|
|
@@ -422,6 +422,20 @@ Use for rich text content:
|
|
|
422
422
|
{{/unless}}
|
|
423
423
|
\`\`\`
|
|
424
424
|
|
|
425
|
+
## Equality Comparisons
|
|
426
|
+
\`\`\`html
|
|
427
|
+
<!-- Show when equal -->
|
|
428
|
+
{{#if (eq fieldA fieldB)}}...{{/if}}
|
|
429
|
+
|
|
430
|
+
<!-- Show when NOT equal (common for Related Posts) -->
|
|
431
|
+
{{#unless (eq slug ../slug)}}
|
|
432
|
+
<a href="{{url}}">{{name}}</a>
|
|
433
|
+
{{/unless}}
|
|
434
|
+
|
|
435
|
+
<!-- Compare to literal string -->
|
|
436
|
+
{{#eq status "published"}}...{{/eq}}
|
|
437
|
+
\`\`\`
|
|
438
|
+
|
|
425
439
|
## Loop Variables
|
|
426
440
|
Inside {{#each}}:
|
|
427
441
|
- \`{{@first}}\` - true for first item
|
|
@@ -431,12 +445,19 @@ Inside {{#each}}:
|
|
|
431
445
|
## Parent Context (\`../\`)
|
|
432
446
|
Inside loops, access the parent scope:
|
|
433
447
|
\`\`\`html
|
|
448
|
+
<!-- Filter posts by current author -->
|
|
434
449
|
{{#each blogs}}
|
|
435
450
|
{{#if (eq author.name ../name)}}
|
|
436
|
-
<!-- Only show posts by current author -->
|
|
437
451
|
<h3>{{name}}</h3>
|
|
438
452
|
{{/if}}
|
|
439
453
|
{{/each}}
|
|
454
|
+
|
|
455
|
+
<!-- Related Posts (exclude current) -->
|
|
456
|
+
{{#each blogs limit=3}}
|
|
457
|
+
{{#unless (eq slug ../slug)}}
|
|
458
|
+
<a href="{{url}}">{{name}}</a>
|
|
459
|
+
{{/unless}}
|
|
460
|
+
{{/each}}
|
|
440
461
|
\`\`\`
|
|
441
462
|
|
|
442
463
|
- \`../name\` - Parent item's name field
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../src/tools/get-example.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GACZ,gBAAgB,GAChB,uBAAuB,GACvB,0BAA0B,GAC1B,qBAAqB,GACrB,oBAAoB,GACpB,eAAe,GACf,oBAAoB,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,4BAA4B,GAC5B,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,WAAW,GACX,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../src/tools/get-example.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GACZ,gBAAgB,GAChB,uBAAuB,GACvB,0BAA0B,GAC1B,qBAAqB,GACrB,oBAAoB,GACpB,eAAe,GACf,oBAAoB,GACpB,kBAAkB,GAClB,wBAAwB,GACxB,4BAA4B,GAC5B,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,WAAW,GACX,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,qBAAqB,CAAC;AA61B1B;;GAEG;AACH,wBAAsB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1E"}
|
|
@@ -775,33 +775,47 @@ Inside loops, access the **parent scope** (the page's current item) using \`../\
|
|
|
775
775
|
|
|
776
776
|
Compare two values using \`(eq field1 field2)\` helper:
|
|
777
777
|
|
|
778
|
-
|
|
778
|
+
## Show When Equal ({{#if (eq ...)}})
|
|
779
779
|
\`\`\`html
|
|
780
780
|
{{#if (eq author.slug ../slug)}}
|
|
781
781
|
<span class="current-author-badge">✓ Your Post</span>
|
|
782
782
|
{{/if}}
|
|
783
|
+
\`\`\`
|
|
783
784
|
|
|
784
|
-
{{#
|
|
785
|
-
|
|
786
|
-
|
|
785
|
+
## Show When NOT Equal ({{#unless (eq ...)}}) - IMPORTANT!
|
|
786
|
+
The most common pattern for "Related Posts" or "Other Items" sections:
|
|
787
|
+
|
|
788
|
+
\`\`\`html
|
|
789
|
+
<!-- On a blog post page, show other posts EXCEPT the current one -->
|
|
790
|
+
<h3>Related Posts</h3>
|
|
791
|
+
{{#each blogs limit=3}}
|
|
792
|
+
{{#unless (eq slug ../slug)}}
|
|
793
|
+
<article>
|
|
794
|
+
<a href="{{url}}">{{name}}</a>
|
|
795
|
+
<p>{{postSummary}}</p>
|
|
796
|
+
</article>
|
|
797
|
+
{{/unless}}
|
|
798
|
+
{{/each}}
|
|
787
799
|
\`\`\`
|
|
788
800
|
|
|
789
|
-
**
|
|
801
|
+
**How it works:**
|
|
802
|
+
- \`../slug\` accesses the current page's slug (parent context)
|
|
803
|
+
- \`slug\` is the loop item's slug
|
|
804
|
+
- \`{{#unless (eq slug ../slug)}}\` shows content when they're NOT equal
|
|
805
|
+
- This excludes the current post from the "related" list
|
|
806
|
+
|
|
807
|
+
## Compare Field to Literal String ({{#eq}})
|
|
790
808
|
\`\`\`html
|
|
791
809
|
{{#eq status "published"}}
|
|
792
810
|
<span class="badge badge-success">Published</span>
|
|
793
811
|
{{/eq}}
|
|
794
812
|
|
|
795
|
-
{{#eq type "featured"}}
|
|
796
|
-
<div class="featured-highlight">⭐ {{name}}</div>
|
|
797
|
-
{{/eq}}
|
|
798
|
-
|
|
799
813
|
{{#eq category "news"}}
|
|
800
814
|
<span class="news-icon">📰</span>
|
|
801
815
|
{{/eq}}
|
|
802
816
|
\`\`\`
|
|
803
817
|
|
|
804
|
-
|
|
818
|
+
## Inside Loops with Parent Context
|
|
805
819
|
\`\`\`html
|
|
806
820
|
{{#each blogs}}
|
|
807
821
|
<article class="{{#if (eq author.name ../name)}}highlight{{/if}}">
|
|
@@ -813,11 +827,19 @@ Compare two values using \`(eq field1 field2)\` helper:
|
|
|
813
827
|
{{/each}}
|
|
814
828
|
\`\`\`
|
|
815
829
|
|
|
830
|
+
## Summary Table
|
|
831
|
+
|
|
832
|
+
| Syntax | Shows content when... |
|
|
833
|
+
|--------|----------------------|
|
|
834
|
+
| \`{{#if (eq a b)}}\` | a equals b |
|
|
835
|
+
| \`{{#unless (eq a b)}}\` | a does NOT equal b |
|
|
836
|
+
| \`{{#eq field "value"}}\` | field equals "value" |
|
|
837
|
+
|
|
816
838
|
**Common Use Cases:**
|
|
817
|
-
-
|
|
818
|
-
-
|
|
819
|
-
-
|
|
820
|
-
-
|
|
839
|
+
- Related posts (exclude current) - use \`{{#unless (eq slug ../slug)}}\`
|
|
840
|
+
- Filter by current author/category - use \`{{#if (eq author.slug ../slug)}}\`
|
|
841
|
+
- Highlight active items - use \`{{#if (eq ...)}}\`
|
|
842
|
+
- Show badges for specific statuses - use \`{{#eq status "value"}}\``,
|
|
821
843
|
};
|
|
822
844
|
/**
|
|
823
845
|
* Returns example code for a specific pattern
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-schema.d.ts","sourceRoot":"","sources":["../../src/tools/get-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"get-schema.d.ts","sourceRoot":"","sources":["../../src/tools/get-schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CA6TjD"}
|
package/dist/tools/get-schema.js
CHANGED
|
@@ -103,6 +103,7 @@ Downloadable files and documents.
|
|
|
103
103
|
|
|
104
104
|
### Conditionals
|
|
105
105
|
\`\`\`html
|
|
106
|
+
<!-- Check if a field has a value -->
|
|
106
107
|
{{#if mainImage}}
|
|
107
108
|
<img src="{{mainImage}}" alt="{{name}}">
|
|
108
109
|
{{else}}
|
|
@@ -114,6 +115,50 @@ Downloadable files and documents.
|
|
|
114
115
|
{{/unless}}
|
|
115
116
|
\`\`\`
|
|
116
117
|
|
|
118
|
+
### Collection Empty Checks (Page Level)
|
|
119
|
+
Check if a collection has items - useful for "No posts yet" fallbacks:
|
|
120
|
+
|
|
121
|
+
\`\`\`html
|
|
122
|
+
{{#each blogs}}
|
|
123
|
+
<article>{{name}}</article>
|
|
124
|
+
{{/each}}
|
|
125
|
+
|
|
126
|
+
{{#unless blogs}}
|
|
127
|
+
<p>No posts yet. Check back soon!</p>
|
|
128
|
+
{{/unless}}
|
|
129
|
+
\`\`\`
|
|
130
|
+
|
|
131
|
+
**Important:** The \`{{#if blogs}}\` and \`{{#unless blogs}}\` syntax checks if the collection has any published items. Use this OUTSIDE of \`{{#each}}\` loops for empty state handling.
|
|
132
|
+
|
|
133
|
+
### Equality Comparisons in Conditionals
|
|
134
|
+
Compare two field values using the \`(eq field1 field2)\` helper:
|
|
135
|
+
|
|
136
|
+
\`\`\`html
|
|
137
|
+
<!-- Show content when fields ARE equal -->
|
|
138
|
+
{{#if (eq author.slug ../slug)}}
|
|
139
|
+
<span>This is your post!</span>
|
|
140
|
+
{{/if}}
|
|
141
|
+
|
|
142
|
+
<!-- Show content when fields are NOT equal -->
|
|
143
|
+
{{#unless (eq slug ../slug)}}
|
|
144
|
+
<a href="{{url}}">{{name}}</a>
|
|
145
|
+
{{/unless}}
|
|
146
|
+
\`\`\`
|
|
147
|
+
|
|
148
|
+
**Common use case - Related Posts (exclude current):**
|
|
149
|
+
\`\`\`html
|
|
150
|
+
<h3>Other Posts</h3>
|
|
151
|
+
{{#each blogs limit=3}}
|
|
152
|
+
{{#unless (eq slug ../slug)}}
|
|
153
|
+
<article>
|
|
154
|
+
<a href="{{url}}">{{name}}</a>
|
|
155
|
+
</article>
|
|
156
|
+
{{/unless}}
|
|
157
|
+
{{/each}}
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
This pattern is essential for "Related Posts" sections where you want to show other posts but NOT the current one.
|
|
161
|
+
|
|
117
162
|
### Loop Variables
|
|
118
163
|
Inside \`{{#each}}\` blocks:
|
|
119
164
|
- \`{{@first}}\` - true for first item
|
|
@@ -149,17 +194,24 @@ Inside loops, access the parent scope (page's current item) using \`../\`:
|
|
|
149
194
|
- Category pages: filter items by current category
|
|
150
195
|
- Related items: match based on current detail page
|
|
151
196
|
|
|
152
|
-
### Equality
|
|
153
|
-
Compare two values in conditionals:
|
|
197
|
+
### Equality Helpers Summary
|
|
154
198
|
|
|
199
|
+
| Syntax | When to use | Shows content when... |
|
|
200
|
+
|--------|-------------|----------------------|
|
|
201
|
+
| \`{{#if (eq field1 field2)}}\` | Compare two fields | Fields ARE equal |
|
|
202
|
+
| \`{{#unless (eq field1 field2)}}\` | Exclude matches | Fields are NOT equal |
|
|
203
|
+
| \`{{#eq field "value"}}\` | Compare to string | Field equals string |
|
|
204
|
+
|
|
205
|
+
**Examples:**
|
|
155
206
|
\`\`\`html
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
207
|
+
<!-- Show only when author matches current page -->
|
|
208
|
+
{{#if (eq author.slug ../slug)}}...{{/if}}
|
|
209
|
+
|
|
210
|
+
<!-- Show all EXCEPT current item (Related Posts pattern) -->
|
|
211
|
+
{{#unless (eq slug ../slug)}}...{{/unless}}
|
|
159
212
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
{{/eq}}
|
|
213
|
+
<!-- Compare field to a literal value -->
|
|
214
|
+
{{#eq status "published"}}...{{/eq}}
|
|
163
215
|
\`\`\`
|
|
164
216
|
|
|
165
217
|
### Rich Text (Triple Braces)
|
package/package.json
CHANGED