# Create/append to page data from custom Liquid tag

**URL:** <https://talk.jekyllrb.com/t/create-append-to-page-data-from-custom-liquid-tag/8470>\
**Category:** Help\
**Created:** [August 17, 2023, 4:49pm UTC](https://talk.jekyllrb.com/t/create-append-to-page-data-from-custom-liquid-tag/8470 "2023-08-17T16:49:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlconlin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jlconlin/32/2845_2.png) [@jlconlin](https://talk.jekyllrb.com/u/jlconlin)\
**Post date:** [August 17, 2023, 4:49pm UTC](https://talk.jekyllrb.com/t/create-append-to-page-data-from-custom-liquid-tag/8470/1 "2023-08-17T16:49:31Z")

</div>

I’ve created a custom Liquid tag. I want this tag to create (or append) an array called `facilities`. My code is copied below. It seems to do this just fine as evidenced by the `print` statement. However, when I try to access the data in a page or post with `{{ page.facilities }}` I get a `null` value returned. It seems the `facilities` array isn’t kept.

How can I keep my `facilities` array?

```auto
module Jekyll
  class Facility < Liquid::Tag
    def initialize(tag_name, input, tokens)
      super
      @name = input.strip
    end

    def render(context)
      begin
        page = context.environments.first['page']

        @tags = page['tags']
        @tags.append(@name) unless @tags.include?(@name)

        page['facilities'] = [] unless page.key?('facilities')
        @facilities = page['facilities']
        print( "Facilities: #{@facilities}")
        @facilities << @name unless @facilities.include?(@name)

    end
  end
end

Liquid::Template.register_tag('facility', Jekyll::Facility)

```
