説明例
In this example we customise the default post page by adding elements and extra data.
どのように構築したか
コレクション
For this example we used the database collections automatically added to your site if you have a blog and an additional one of our own:
-
Blog/Posts collection: Contains information about your individual blog posts
-
Blog/Categories collection: Contains information about your blog categories
-
Post Extra Data collection: Contains additional information about your blog posts with references to the original post item in the Blog/Posts collection.
ページ要素
In our site we added the following page elements:
-
Strip: Custom header strip for the post page:
-
Text: Author name
-
Text: Photographer name
-
Text: Post title
-
コード
We added the following code to the Post page:
-
When the Post page loads:
-
Get the current post data using the getPost() function.
-
Retrieve the extra post data using the ID of the current post.
-
Merge the post data with the extra post data using the object.assign() method.
-
Populate the merged data in the relevant page elements.
-
関連例
これは役に立ったか?
|
ご意見ありがとう!
カスタムコメント
カスタム投稿コメントセクションの作成
初心者
カスタムいいねボタン
自分だけの「いいね!」ボタンを作ろう。
中級
関連記事
Display related posts in your blog post page
初心者