Populating a navbar with dynamic content on every page - twig

I'm building a blog-like template using Sculpin, and need to populate a sidebar with categories. This sidebar is supposed to be visible on every page. However, Layouts don't seem to interpret YAML frontmatters like Sources do. This makes it problematic to create a globally visible menu that gets populated based on the content data (eg. posts).
I can reference data.posts_categories if the current Source's YAML frontmatter has:
---
use:
- posts_categories
---
and I'm fine with just putting it in every Source file. However, there are also Views (like "post.html"), which again do not support YAML information.
Based on this post, apparently you can declare a list of properties. However this apparently only allows to declare constants.
In other words: I need to be able to reference posts and categories in layouts (in the master template). Is there a way to do that, or something similar?

Related

Sharepoint online use the same new/display/edit forms for two or more libraries

I'm trying to develop a Sharepoint online site to show inventory of every departments. Since I have several thousands of items, I separate the items into several libraries by departments. Each library will have the same columns.
Currently, I'm facing a problem of how to standard the new/display/edit forms for all libraries. Of cause I can use library template to do so. But what if I need to update the form, e.g. add a reference link or change the layout? Then I need to modify the form one by one for each library.
Is there any solutions that I can create one master form so that (1) it can be applied to two or more libraries, and (2) whenever the master form is changed, the change is automatically applied to the libraries?
Thanks
This is a great use case for Content Types.
At the Site Settings level, Create the columns you want. Then create the Content type you want, called "Inventory" for example. Add the columns to that Content Type.
Add the content type to each library.
Library Settings -> Advanced Settings -> Allow Management of Content Types
Remove the default content type from the library settings page
Now, you can update the columns at the site Content Type level, and it will publish to and update each library.

SharePoint - Document Filtering (Tags/Metadata?)

I'm creating a SharePoint site which will be used to dynamically store and display documents on various pages, among other things. Is the following possible?
My view is to have one central Document Library which will include all files. Files with have 'tags' or 'metadata' attached to them. On pages, i will add a document library (or similar) webpart and then call only those documents with a certain tag/metadata.
For example.
Document Library ('Folder') - Contains ('Project Document.xls' and 'Training Document.ppt')
On 'index.html' i will add 'Folder' to the page, but i only want to display 'Project Document.xls' not 'Training Document.ppt'.
I'm aware that you can set up target audiences but that requires a lot of user management.
Thanks for any advice.
If I understand you correctly, this sounds like something you could accomplish using a filter. The name of the file is stored as a column. Try editing the web part on that page and edit the current view. That view will be cached for that page without changing the view across the site. If you want to be able to dynamically choose the document you display then one option is to add an HTML Form web part (which contains a text box and submit button), connect it to the doc library web part and filter the name column based on the HTML Form web part.

Programmable datasource for file download control?

I want a file download on my page where I look up the attachemnts to be displayed from another document based on the value of a field.
I tried a couple of things including returning the value obtained from NotesRichTextItem.GetEmbeddedObject but everyting I try I get the error java.util.Vector incompatible with [Lcom.ibm.xsp.model.FileRowData
What do I need to call to return a proper value to my file download control?
I realize I could proably display the attachment links using a repeat control but was hoping there was an easier way.
The FileDownload control requires a NotesDocumentDataSource. There's no way around that. So you could add a panel to you page, add a Notes Document DataSource to that panel that computes the UNID of that document, add a file download control bound to that panel and you are good to go. The FileDownload control will show all files in that document.
Keep in mind: an XPage is not bound to a (one) document and can contain as many data sources as needed.
If you want to construct the URLs yourself, check the cheatsheet

How to apply Dreamweaver templates on an existing site

I have an existing site in a path, and I've pointed the DreamWeaver site to it.
Under \templates there is a master.dwt file. But whenever I save this file, none of the html files which should make use of it change. What do I need to do to get DW to update the html files that make use of it? And how does DW know which files should be updated based on the template changing? Does it use an internal store or something because every time I copy the site to another machine, I'll need to link up all the pages to the relevant templates again.
I've tried going into Modify | Templates | Apply, but no templates are listed. I have a .dwt file in the path so why isn't it picking it up??
There's several possible issues in play here:
For Dreamweaver to properly recognize the existence of the template, the folder in the root of the site should be Templates and not templates.
Once Dreamweaver "sees" the Template properly you then need to make sure that the proper code is present in the child HTML files so Dreamweaver knows which files to update via the template. This code takes the form of HTML comments scattered throughout the page. You will always have the following line after the <html> tag:
<!-- InstanceBegin template="/Templates/TemplateName.dwt" codeOutsideHTMLIsLocked="false" -->
After that, editable regions are delineated with code that will look like this:
<!-- InstanceBeginEditable name="someregion" -->
stuff you can edit
<!-- InstanceEndEditable -->
Without the above, the child pages will not respond to the template.
Now for the real bad news. Unless the existing pages match up with the template exactly, you are going to have all kinds of problems getting the template to play nicely with the existing content. Doing Modify | Template | Apply Template to the page when the page is already fully formed will generate a dialog box that asks you map the content to the editable regions in the template. But if the rest of the design elements vary from what the template contains, Dreamweaver will preserve those tags alongside what the template will introduce which usually creates a ton of duplicated tags and broken layouts.
You would be FAR better off creating new, blank pages from the Dreamweaver Template and copy/pasting the contents into the editable area and then overwriting the "old" pages with the Save As command.
I just encountered this issue myself. I realize this original question was posted some time ago, but for anyone who might encounter this problem in the future, I am posting my solution.
If the only changes made to the template relate to one or more elements contained in an attached/linked file (such as a CSS style sheet or JS file), which changes Dreamweaver allows directly from the .dwt template itself, using the style boxes at the side/bottom, then Dreamweaver does not perceive any change to the actual .dwt file itself. If you want those changes to "take effect" and apply them to all pages, you might type a change to the .dwt file itself, click "save all" - undo the change and click "save all" again. This step is really not entirely necessary, as the changes to dependent files can be affected to the website by putting the dependent file to the website.
Also, Dreamweaver will apply changes to CSS/JS dependent files, across the board, but may continue to use a cache, until closed and reopened.

Sharepoint 2007 Custom List Templates

Hi I am wanting to create a little tutorial on how to create a webpart that I have added to one of the website's I have created.
I know that there is the List Templates gallery in which I could use to give this part as a file however I am using Site Columns.
Due to this will this cause errors when importing to a new Site?
Will the user need to create the Site Columns previously and will they automatically be used once importing my Custom List file?
or will when it is imported the column appear?
I don't currently have another site to test this on as yet so was wondering if anyone here already knew the answer for this?
Any light that can be shed on this question is very much appreciated and thanks in advance as well =]
I am totally confused by your question. How are List Templates gallery and a custom webpart related ?
Probably you meant site Template Gallery ?
What you need to do is :
- Create a solution package
- Create two features - one for your custom columns and custom webpart
- Optionally create a list template feature to define the columns in the list.
If this is truly a list template (you created it by going into List Settings and selecting Save As Template), then the site columns, content type, and list schema should all be contained in the manifest.xml file inside the stp file. You should not need to create anything manually to generate a list based on a template uploaded to the List Templates Gallery.
If this is a list definition feature, then you should create features that define the site columns, content type, and the list definition. The users can manually create site columns that match on name, type, and just about every other attribute, except the one that matters most - ID. Each time a site column is created in the browser, it will be assigned a different ID. That ID will not match what you have defined in your list definition.

Resources