On the page settings there are the following options.
Cacheable
Searchable
Show in menu
I suggest a "Show in sitemap" be added with an on / off checkbox.
Yes we can make a sitemap from Wayfinder but there are drawbacks there. There are times I have documents I would want in a sitemap but not in a menu. If this feature was available, it would be easy to modify Wayfinder to take advantage of it and build a true sitemap and not a "menumap".
It should be an easy add. A small line in the manager and a new column in the table. So what do you think?
Maybe better to do/modify some snippet to check for a TV value if it will be included to the sitemap or not..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Wouldn’t a third party TV be template specific and not document specific?
A document specific variable like "searchable - [0|1] Whether or not the document is to be searchable." is pulled from the documents table and is hard coded.
I think for the normal end user who is writing the content, it would be more logical to have it as a checkbox. Having to setup almost 2 identical templates just with separate names so that article writers can select the one that is going to be part of the sitemap isn’t a good solution.
And then it becomes harder to edit Wayfinder to use such a system because it would need to access the database and go off of a template name and not just an on / off switch.
Or am I misunderstanding what you where suggesting?
-
MODX Staff
- 10,725 Posts
doze was simply suggesting that you create a single TV, assigned to all your templates. Then have your sitemap snippet check the value of that TV for each document.
If every setting like this would be done as own settings to the core, there would soon be billions of different options and settings for a simple document that many would’nt want. TV’s are perfect for this. I would like that all of the current document fields would be optional TVs actually, and in 1.0 they will be.
Anyways, you should really look into TV’s. You can do TV as checkbox just fine. Put default value to 0 and checked value to 1. Then assign it to all of your templates and when you create a new document, you will see that checkbox there. Then modify Wayfinder to look for that TV value from the documents when it goes through them.
Same result without a hack.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
OK so I’m looking around the TV docs. I think I am getting it. When I had read through the docs before I don’t think I got it.
Is there an example in the repository or the forums that you can point out that stores a variable on a per document basis in the database? I’m not seeming to be able to figure it out via the docs. All the examples I can find reference pulling info from info that is already in a database. How do I go about adding information to the database that wasn’t there before and where do I store it?
Thanks
I’m not understanding what problem is there in storing variable per document basis in the database with TVs..? Even though TVs are template variables, they store the user inputted data per document.. when you save a document, it saves the TV values for that document in the database. In a snippet, you can get the TV value for a individual document by using
$modx->getTemplateVarOutput and feeding the tv name and document id to it.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
I have attached a TV I created.
It creates 2 radio buttons in the document settings with "Yes / 1" being the default select.
Now if I select "No / 0" and then save and come back to edit the page, the TV still shows "Yes" selected.
What am I doing wrong?
-
MODX Staff
- 12,272 Posts
You’re most likely using 0921... this issue with TVs and saving values is fixed in 095 betas.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me