Skip to content

Commit bcf6713

Browse files
authored
Merge pull request #5 from dotCMS/jorge-demo
jorge demo
2 parents 8c9fef7 + 2c2f4a6 commit bcf6713

File tree

1 file changed

+21
-77
lines changed

1 file changed

+21
-77
lines changed

README.md

Lines changed: 21 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,24 @@ This allows simple usage in views:
144144
<contentlet-renderer contentlet="@myContentlet" />
145145
```
146146

147+
#### HeaderTagHelper and FooterTagHelper
148+
149+
These TagHelpers provide reusable header and footer components that can be conditionally displayed:
150+
151+
```cshtml
152+
<!-- Basic usage with default content from partial views -->
153+
<header-section show="@(layout?.Header == true)" title="My Site"></header-section>
154+
<footer-section show="@(layout?.Footer == true)" copyright="My Site"></footer-section>
155+
156+
<!-- With custom content -->
157+
<header-section show="@(layout?.Header == true)">
158+
<div class="custom-header">
159+
<h1>Welcome to My Site</h1>
160+
<nav><!-- Navigation items --></nav>
161+
</div>
162+
</header-section>
163+
```
164+
147165
## Request Flow
148166

149167
1. **Browser Request**: User navigates to `/about-us`
@@ -188,17 +206,8 @@ The application is configured through the `appsettings.json` file:
188206

189207
The `proxy` section configures the proxy feature, which forwards specific requests to dotCMS or other target servers. This is particularly useful for handling assets, images, and other resources that need to be served directly from dotCMS.
190208

191-
Each proxy configuration has the following properties:
192-
- `enabled`: Boolean to enable/disable the proxy
193-
- `path`: The URI pattern to match (supports wildcards with *)
194-
- `target`: The target server URL to proxy to
195-
196209
For more details, see [Proxy Documentation](docs/Proxy.md).
197210

198-
You can authenticate using either:
199-
- An API token (preferred for production)
200-
- Username and password
201-
202211
## Architecture Benefits
203212

204213
This MVC + Razor approach provides several advantages:
@@ -210,76 +219,11 @@ This MVC + Razor approach provides several advantages:
210219
5. **Flexibility**: Easy to customize rendering for different content types
211220
6. **Maintainability**: Standard .NET patterns make the code easy to understand
212221

213-
## Key Components
214-
215-
- **DotCmsService**: Service for interacting with the dotCMS API. This includes methods to call dotCMS APIs and the dotCMS graphQL endpoint.
216-
- **DotCmsUVEController**: Controller for handling dotCMS page requests
217-
- **ProxyActionFilter**: Action filter that proxies requests to dotCMS or other target servers based on configured paths
218-
- **ContentletTagHelper**: Renders contentlets based on their content type
219-
- **HeaderTagHelper/FooterTagHelper**: Conditional header/footer rendering
220-
221-
222-
## Usage
223-
224-
The DotCmsUVEController acts as a catchall/proxy for dotCMS pages. When a request is made to any path, the `DotCmsUVEController` will:
225-
226-
1. Forward the uri to the dotCMS Page API to get the Page response, which includes all data regarding the template, layout, content blocks and content and which can be used to composit a page.
227-
2. Parse the response into the appropriate models
228-
3. Render the page using the Razor view
229-
4. Caches the PageAPI response for up to 1 minute for performance.
230-
231-
### TagHelpers
232-
233-
The SDK includes custom TagHelpers to simplify common UI components:
234-
235-
236-
#### ContentletTagHelper
237-
This tag helper accepts a dotCMS contentlet object and passes the content data to a view for appropiate rendering and inclusion on a page. It accepts a Contentlet and based upon that Contentlet's content type, will look for an appropiate `View` file under the `/Views/ContentTypes` to use to render the content.
238-
239-
Things that could be improved - perhaps the ContentletTagHelper should also take the
240-
241-
#### HeaderTagHelper and FooterTagHelper
242-
243-
These TagHelpers provide reusable header and footer components that can be conditionally displayed. The default content is defined in partial views:
244-
245-
- `Views/Shared/_HeaderExample.cshtml` - Default header content
246-
- `Views/Shared/_FooterExample.cshtml` - Default footer content
247-
248-
Usage examples:
249-
250-
```cshtml
251-
<!-- Basic usage with default content from partial views -->
252-
<header-section show="@(layout?.Header == true)" title="My Site"></header-section>
253-
<footer-section show="@(layout?.Footer == true)" copyright="My Site"></footer-section>
254-
255-
<!-- With custom content -->
256-
<header-section show="@(layout?.Header == true)">
257-
<div class="custom-header">
258-
<h1>Welcome to My Site</h1>
259-
<nav>
260-
<ul>
261-
<li><a href="/">Home</a></li>
262-
<li><a href="/about">About</a></li>
263-
</ul>
264-
</nav>
265-
</div>
266-
</header-section>
267-
```
268-
269-
Key features:
270-
- Conditional rendering based on the `show` attribute
271-
- Default content loaded from partial views
272-
- Support for custom content when provided between tags
273-
- Customizable through attributes (`title` for header, `copyright` for footer)
274-
275-
See `Views/Shared/_TagHelperExamples.cshtml` for more detailed examples.
276-
277-
278222
## TODOs
279-
This is a WIP and there is still a lot to do for this example to be complete. These include:
280223

224+
This is a WIP and there is still a lot to do for this example to be complete. These include:
281225

282-
- Transform dotCMS Graphql Page API response so that it renders like the PageAPI does.
226+
- Transform dotCMS Graphql Page API response so that it renders like the PageAPI does
283227
- Add the required `data-attr` for UVE and containers, content
284228
- Add include the uve-editor.js to "activate" uve when rendered in dotCMS
285-
- Make content type components "container" aware - meaning look for the content type `View` under `/Views/ContentTypes/{containerName}/{ContentType}.cshtml` and then fall back to `/Views/ContentTypes/{ContentType}.cshtml` if a container specific view is not available.
229+
- Make content type components "container" aware - meaning look for the content type `View` under `/Views/ContentTypes/{containerName}/{ContentType}.cshtml` and then fall back to `/Views/ContentTypes/{ContentType}.cshtml` if a container specific view is not available

0 commit comments

Comments
 (0)