apostrophe-pages | pages adds page rendering to the Apostrophe content | Data Visualization library
kandi X-RAY | apostrophe-pages Summary
kandi X-RAY | apostrophe-pages Summary
apostrophe-pages adds page rendering to the Apostrophe content management system. The apostrophe-pages module makes it easy to serve pages, fetching the requested page and making its content areas available to your page templates along with any other attributes of interest.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of apostrophe-pages
apostrophe-pages Key Features
apostrophe-pages Examples and Code Snippets
Community Discussions
Trending Discussions on apostrophe-pages
QUESTION
I would like to add a button to allow the public user to save simple true/false boolean values in their session and change things in the template according to those decisions. I think there are quite a few scenarios where something like this applies, like light/dark theme choice, "are you over 18" age queries or GDPR/Privacy stuff, where google analytics scripts need to be loaded only after the users decision.
For example I when I want to add a theme choice for public users.
This are my fields in my apostrophe-palette-global:
...ANSWER
Answered 2021-Apr-12 at 21:18Apostrophe doesn't have a preference for reading/writing a browser storage endpoint, you'll have to roll your own with custom front end scripts that read/write and maintain your state.
Below are some more detailed notes based on your code samples, you might not need this if you have a pretty good grasp on what to do when the answer to your original question is "no" :)
- The way you're handling theme styles via palette seems good, although I would alter your selectors to follow something higher in the DOM, like
QUESTION
I'm following this answer which was really useful for me to have some pre-defined widgets on newly created pages.
...ANSWER
Answered 2021-Apr-08 at 22:23I think if this was added before the database was ever created then beforeInsert
would cover it. Since there wasn't a home page yet, it would be inserted when the app first starts up. But let's assume you already created the app.
This might be job for a migration. You could write a migration that looks for the home page (slug: '/'
) and looks to see if that area is empty. If it is, then update the doc with your data. It should only run once since migrations are tracked in a database collection. Even if it does run again, as long as you are querying only "home pages" that don't yet have the data, you'll be safe.
QUESTION
I need to add a column on the 'Pages' modal in the Apostrophe CMS and potentially override the existing column titles (i.e. "Link" to something a little more intuitive). The closest thing I saw in the online documentation was here: https://docs.apostrophecms.org/apostrophe/reference/modules/apostrophe-pages#contextmenu
Though, when I paste the example code into my apostrophe-pages/index.js, I don't see any change anywhere in the CMS.
Hope someone can offer any insight!
...ANSWER
Answered 2020-Feb-26 at 16:36The contextMenu
is the menu revealed by the button in the bottom left. It's named that because it (generally) reflects the context in which it's being used (e.g., "new-page" creates a new page as a child of the page you're on).
Generally for pieces you would want to look at the "Adding columns" documentation. However pages are special, so have their own "reorganize" view and accompanying JS to control the page tree structure.
QUESTION
I'm interested into a method like self.play
from apostrophe-widgets that permit us apply Jquery selectors without having any doubt that the selector only should be applied to the widget, thanks to $widget
parameter.
What I want to obtain is the same behaviour but with apostrophe-pages, I've research into the documentation and I didn't find anything. Is there any way to replicate the same behaviour?
I let a reference to the method I'm talking about to clarify the question. https://docs.apostrophecms.org/apostrophe/modules/apostrophe-widgets#more
Thanks for your help!
...ANSWER
Answered 2019-Jul-26 at 14:35Currently there is no equivalent player
for pages. Typically we push those front-end modules all the time and let them decide when they're relevant or not. Because there is no equivalent, there is no concept of a safe jQuery $widget
object or data
about the page being passed down.
That pattern around pushing page-specific modules is illustrated in the Open Museum demo in the apostrophe-assets
module.
https://github.com/apostrophecms/apostrophe-open-museum/tree/master/lib/modules/apostrophe-assets
A widget's player
method is really nice because it knows to re-run itself when Apostrophe does various editing/saving operations. You can get similar re-running behavior anywhere by listening for the front-end apos
event ready
. A bit of documentation on that here https://docs.apostrophecms.org/apostrophe/tutorials/howtos/migration#browser-side-javascript-is-pretty-close-to-the-same
QUESTION
I was playing with Apostrophe CMS, and tried to create a widget which gets some values from a third party API based on its settings. Is there any way I could retrieve the values of the widget inside the widget index.js? Basically when the admin creates a page, he will add a widget with some values set. And the widget behavior should change based on those settings. Is this possible at all and if it is then how?
...ANSWER
Answered 2019-May-16 at 17:47If you want to do something to a widget before it renders on a page you can hook into the widget's load
method in it's index.js
QUESTION
I am trying to get the children of apostrophe pages to appear in my navigation object - however the _children array is always empty. My page does have child pages set up via the front end Pages UI.
My index.js for the lib/modules/apostrophe-pages module contains the following:
...ANSWER
Answered 2019-Mar-28 at 21:29Solved it..
I needed to add 'rank: 1, path: 1, level: 1'
to the projection as per this page in the documentation: https://apostrophecms.org/docs/tutorials/howtos/children-and-joins.html#projections-and-children
QUESTION
In order to have a common setup in most of my Apostrophe projects, I plan on building some custom npm-modules to bundle them and add them to my projects. Some of the features I would like to do in them, appart from adding widgets and backend functionality, is editing official apostrophe modules' setup (e.g., setting up default page types for apostrophe-pages
) and overriding nunjuck blocks and/or templates.
Both things can easily be overwritten on a project-level configuration with Apostrophe's implicit subclassing mechanism, so my goal of sharing a common base setup for different projects could be achieved with a custom boilerplate, although I would lose the ability of upgrading my defaults by releasing new versions of my node modules.
All in all, I was thinking in a Maven-style dependency hierarchy like this:
Apostrophe npm modules <- custom npm modules <- project modules
Coming form a Java and Maven based CMS, I understand I will need to change my way of thinking in many things, so: is what I'm trying to do possible and does it make sense in the Apostrophe world? What would be "The Apostrophe Way" to achieve something like this? Do I need to create a custom npm module to with the moog option improve
for each module I want to extend?
Thanks in advance.
...ANSWER
Answered 2019-Jan-15 at 14:40Even in the npm_modules
directory, apostrophe will scaffold out base modules first and modules that extend those modules second, meaning your custom npm modules will follow the same inheritance chain as the official apostrophe modules. You can override them the same way you would any other apostrophe module.
meta module (apostrophe-pieces) > custom-pieces (piece extension, custom npm module) > custom-pieces (project-level overrides)
You would just selectively override files and methods in lib/modules/
the same way you'd override parts of apostrophe-blog
, like lib/modules/custom-pieces/views/widget.html
Am I correctly understanding the way you want to override things?
QUESTION
I'm attempting to add a custom page, that will not be associated with a particular type of piece or other set of data. It will be used to run actions for reporting and processing/showing data, so it needs to be fairly stand-alone. I want it to be a page type, so it will be handled in navigation the same way that any other page is. I mostly have it working, but am running into an issue - no matter how I set it up, when I try to navigate to an instance of the page that gets created, it always looks for the template in lib/modules/apostrophe-pages/views/pages instead of the module folder.
In this case, I'm currently calling the module test-item (will rename once I figure out what the issue is). So, I have a folder called lib/modules/test-item, with index.js and views/index.html. I also attempted to rename the template in the views folder to show.html and test-item.html just to be sure it wasn't a naming issue. Here's how the module is configured in index.js:
...ANSWER
Answered 2018-Dec-15 at 19:35apostrophe-custom-pages
templates still live in the project level lib/modules/apostrophe-pages/views/pages/MODULE-NAME.html
.
If you're trying to fully modularize a custom page as an npm module you can make an improve
based module which can add a view to the apostrophe-pages
module.
QUESTION
This error came out on my console when I configured pieces in same database name using apos.singleton
, but I managed to delete directly from DB itself using $unset method :
ANSWER
Answered 2018-Aug-24 at 12:59I am not sure why you are using $unset
to unset the someDate
property, which is not related to this issue.
The issue is that you still have docs in your aposDocs
collection which have the type
property set to portfolios
, tryComment
, or trycomment
.
Assuming you really want them gone, you can remove them this way (mongo shell example):
db.aposDocs.remove({ type: { $in: [ 'portfolios, 'tryComment', 'trycomment' ] } });
$unset
has nothing to do with removing documents. It unsets particular properties of documents that remain in the database.
QUESTION
In Apostrophe, I have a custom module where I would like to pass an option from the Nunjucks apos.area
call to the construct method of the widget itself. Concretely, I want to adjust the output of getWidgetWrapperClasses
based on the options passed to the module in the template. Is this possible?
Here's an example of what I would like to achieve:
lib/modules/example-widgets/index.js
ANSWER
Answered 2018-Aug-03 at 11:45I solved this by not using the getWidgetWrapperClasses
method, but instead extending the widget wrapper template and overriding a Nunjucks block in there. This is in fact a documented approach if you look in lib/modules/apostrophe-areas/views/widgetBase.html
in Apostrophe's code.
I changed lib/modules/example-widgets/index.js
like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install apostrophe-pages
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page